Warning: include() [function.include]: Unable to access /var/www/html/rogue-development/blog2/wp-content/advanced-cache.php in /var/www/html/rogue-development/blog2/wp-settings.php on line 62

Warning: include(/var/www/html/rogue-development/blog2/wp-content/advanced-cache.php) [function.include]: failed to open stream: No such file or directory in /var/www/html/rogue-development/blog2/wp-settings.php on line 62

Warning: include() [function.include]: Failed opening '/var/www/html/rogue-development/blog2/wp-content/advanced-cache.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/rogue-development/blog2/wp-settings.php on line 62

Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in /var/www/html/rogue-development/blog2/wp-includes/functions.php on line 3468

Notice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /var/www/html/rogue-development/blog2/wp-includes/functions.php on line 3382

Notice: register_widget_control is deprecated since version 2.8! Use wp_register_widget_control() instead. in /var/www/html/rogue-development/blog2/wp-includes/functions.php on line 3382
Timezone freakiness « Marc’s Musings

Timezone freakiness

Just solved a mind-boggling problem I was having with some date manipulation.

The Date constructor returns a date with a different timezone depending on whether the date is today & before, or in the future.

var today:Date = new Date();

var yesterday:Date = new Date( today.fullYear, today.month, today.date – 1 );

var today2:Date =    new Date( today.fullYear, today.month, today.date     );

var tomorrow:Date =  new Date( today.fullYear, today.month, today.date + 1 );

trace( yesterday.timezoneOffset );

trace( today2.timezoneOffset );

trace( tomorrow.timezoneOffset );

Traces output:

300

300

240

What’s worse if you then subtract a day from “tomorrow” it doesn’t equal today.

tomorrow.date–;

trace( tomorrow.time == today.time );

trace( tomorrow == today );

Output: false / false

Guess why?

Today’s daylight savings switchover day.  Arghhh.

I really wish Actionscript had a date-only type.

0 Responses to “Timezone freakiness”


Comments are currently closed.