Whoops, sorry. Should have been: var utcH:Number = -5;// New York: EST
Regards, -Keith http://keithreinfeld.home.comcast.net <http://keithreinfeld.home.comcast.net/> _____________________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Keith Reinfeld Sent: Wednesday, December 10, 2008 1:07 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Change Timezone Pratik, > I would like to know if there is any way to dynamically change the > timezone in flex. Not literally, no. > Say suppose we have local time and few check boxes to see time in > other timezones. When you check and uncheck the check box the time > changes according to the selected timezone. This would not depend on > the location of the persons timezone. So persons local timezone may be > PST but he wants to see the data in EST. To calculate the time elsewhere you have to factor-in the local machine's timezone offset value. I worked out the following for my World Clock last year: <snip> // Local Time var lDate:Date = new Date(); // Elsewhere Time var utcH:Number = -8;// New York: EST var utcM:Number = 0; var wDate:Date = new Date(lDate.getTime() + (lDate.getTimezoneOffset() * 1000 * 60) + (utcH * 1000 * 60 * 60) + (utcM * 1000 * 60)); trace("wDate = "+wDate); </snip> Note: The GMT value in the trace will still reflect the local machine's timezone. Just ignore it. The important data are the time and date. Going forward you will want to consider the issues presented by Daylight Saving Time: Does the locale of the local machine observe DST? Is the locale of the local machine currently in DST? Do they observe DST in the designated Elsewhere? Is the designated Elsewhere currently in DST? Regards, -Keith http://keithreinfeld.home.comcast.net <http://keithreinfeld.home.comcast.net/> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pratikshah83 Sent: Tuesday, December 09, 2008 7:15 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Change Timezone Hi Guys, I would like to know if there is any way to dynamically change the timezone in flex. Say suppose we have local time and few check boxes to see time in other timezones. When you check and uncheck the check box the time changes according to the selected timezone. This would not depend on the location of the persons timezone. So persons local timezone may be PST but he wants to see the data in EST. There is the timezoneoffset method but that just gives you the offset of local timezone with respect to UTC. I hope my issue is clear. Any help would be appreciated. Thanks Pratik
<<attachment: winmail.dat>>