I have been trying to figure out how to determine what time zone the user is in. However, when I use the code below, the hour offset and UTC changes with DST or Daylight Saving Time. I tried to make a forumla to calculate it, but when DST is in effect, my formula does not work. How can I detect if DST is in effect? ...or is there a time that does not change with DST that I can check against in ActionScript?
CODE
// FIGURE OUT TIME ZONE
hoursFromGMT = myTime.getTimezoneOffset()/60;
trace(hoursFromGMT);
hoursFromUTC = myTime.getUTCHours();
trace(hoursFromUTC);
trace results: 4, 20 (at 16:00 EDT), or
trace results: 5, 21 (at 16:00 EST)
The above is very simple. It's not my clock. It's just an illustration of how I'm trying to trace my time zone.
For example, I am in the Eastern Time Zone. So, during EST or Eastern Standard Time, hoursFromGMT = 5, but during EDT or Eastern Daylight Time, hoursFromGMT = 4. Therefore, I cannot say that if hoursFromGMT == 5 then I am in Eastern Time Zone, because during Eastern Daylight Time the value of hourFromGMT would be 4, thus the forumla would say that I'm in the Atlantic Time Zone.
Now, I could create a function to determine which day of the year it is, knowing ahead of time when DST goes into effect, check against that date, then shift the time zone accordingly, but that's a lot of code just to figure out if DST is in effect or not. There must be a simpler way such as...
CODE
zoneShifter = myTime.getDSTinEffectOrNot();
if zoneShifter = 0; {
it's standard time;
} else {
it's daylight time;
}
myNewTimeZone = hoursFromGMT + zoneShifter;
Any sort of trick would be helpful! also, if no shortcut is available, even with FLPro8, I would appreciate it someone could paste the code for a function to check to see if the current day is in the DST range. That is of course if you already have it. I'm not asking you to write it up just for me.