February 5. 20:00 -  Imagine the worst nose itch ever. Then imagine arms that are too short to scratch your nose. #enjoy

ActionScript and Daylight Savings Time

October 27, 2008 15:10 by docbliny

Since the U.S. DST change is coming up this weekend, I thought it would be a good time to remind people about date math in ActionScript.

When working with dates, make sure you don't use milliseconds (UNIX timestamps) to increment/decrement times and dates. Instead, always increment the hours, date and similar properties on Date object.

However, there is a bug in the player currently causing increments to myDate.hours to not do the correct thing. To avoid this problem, use the myDate.hoursUTC property instead.

You can safely add/subtract hours and the Date class will automatically increment the actual underlying date. For example, if the date is 10/27/2008 23:00 and you add an hour, the date will rollover to 10/28/2008 00:00 as expected. The same goes for adding days, months and years.


Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading