Tag Archive for 'date'

02
Feb

Parsing ISO dates with Flex and ActionScript

The following example shows how you can parse an ISO format date (for more information, see http://www.w3.org/TR/NOTE-datetime) and convert it into a Date object in ActionScript using the String class’s replace() method and the static Date.parse() method.

Full code after the jump.

Continue reading ‘Parsing ISO dates with Flex and ActionScript’

24
Aug

Date math for lazy people

I’ve always hated doing simple date manipulation and having to create wacky variables like “millisecondsPerDay” where you multiply milliseconds by seconds by hours by whatever else. So here’s a useful (and largely untested) function, dateAdd(), which is similar to the function that ColdFusion-ers have enjoyed for years.

Full code (and instructions) after the jump.

Continue reading ‘Date math for lazy people’

31
Jul

Calculating the number of days between two selected dates in a DateChooser control

Here’s a marginally more interesting sample. I was playing around with the DateChooser (calendar) control and the selectableRange property and figured I’d make a simple application to calculate the differences between two selected dates. The example creates a selectable range of dates from the current date to current date plus 1 year. Users can select any single or range of dates between the start date and end date, and Flex calculates the number of days the user selected using some basic math.

Full code after the jump.

Continue reading ‘Calculating the number of days between two selected dates in a DateChooser control’