Flex and timezones

A recent post to the AFFUG list ( http://www.affug.org ) re-visited the little surprise about how Flash transmits dates with TZ info. Now, I say surprise because coming form the static world of HTML, this was new to me.

The short story: A Date created in ActionScript on the client will include TZ info. When this Date is passed to the server-side, Java/ColdFusion ( What about .NET, PHP, etc? ), this info is retained and subsequently passed to other systems like your big Oracle DB perhaps. Hey, that’s nice, well except if you want all your Date-Times to be say Eastern.

The skinny: How to address this if you want everything to be locked to a TZ? Well, one way is to use the offset property of Date in ActionScript. Just massage all your dates coming in and out of your Flex app with this offset. Works a treat.

DK


One Response to “Flex and timezones”

  1. Edgar
    March 13th, 2008 | 9:42 am

    I think a better way to address is to convert the Date in Flex to UTC. The Flex Date class allows you to easily do this using the time property in Flex’s Date class. You could then do a known conversion from UTC to eastern, but I would recommend you just deal with all Dates in UTC.

Leave a reply