Whew, took me a while but I was able to get to the bottom of this date stuff. The problem I was seeing was caused by my Java back end not correctly recognizing the time zone information from VISTA. This caused it to return timestamps in milliseconds GMT (instead of the usual adjusted for local time). A simple upgrade of the JDK (was running 1.5_09, upgraded to 1.5_13) fixed that issue. So, it turns out that if your back end is returning time in GMT (also referred to as UTC) then your flex code will always need to adjust accordingly (as indicated by Paul below). If you are fine with your server returning local time (intranet app, etc) then no adjustment is necessary in the Flex code.

Thanks
Scott

Scott Melby wrote:
Paul -

Thanks for the response.

Maybe your XP builds were resulting in dates that had timezoneOffset = 0. If this is the case, the adjustment would have no effect and you would not notice that you didn't need it. If that is not the case, then I am really confused.

Thanks again
Scott

Paul Decoursey wrote:

Odd, I've always had to adjust for the timezone, and I've always
built on XP or OSX. I just assumed that was the way it was supposed
to be.

On Oct 30, 2007, at 11:29 AM, Scott Melby wrote:

> My application uses many dates. Dates are always passed between the
> back end web service and the front end flex app as timestamps,
> milliseconds since epoch. Yesterday I switched to a dev. box that is
> running VISTA... now all of the dates in my application are off by the
> timezoneOffset. I can correct them easily enough as follows:
>
> var millis:Number = d.time;
> var offsetMillis = d.timezoneOffset * 60 * 1000;
> d.time = millis + offsetMillis;
>
> But, I am not sure that this is the right thing to do. I went back
> and
> checked my XP machine setup and verified that it was using the correct
> timezone, and it was. So... why would this behave differently? The
> behavior seems to be dictated by the OS that the .swf file was
> built on
> (or the flex sdk compiler that was used) and not by the OS that the
> flash player is running on. I verified this by accessing a site
> running
> a .swf that I built on XP from both systems... that one handled
> dates as
> I expected (no manual TZ adjustment needed). Then I accessed a site
> running a .swf that I built on my vista box from an XP client and an
> vista client. Both exhibited the need for a time zone correction.
>
> Can anybody tell me what is expected here? Should I adjust for
> timezone
> as above every place in my code where I create dates? Any help is
> appreciated.
>
> Scott
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt <http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> > Search Archives: http://www.mail-archive.com/flexcoders% <http://www.mail-archive.com/flexcoders%>
> 40yahoogroups.com
> Yahoo! Groups Links
>
>
>



Reply via email to