Created
July 13, 2010 23:28
-
-
Save johnlindquist/474739 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//out of DST | |
var a:Date = new Date(2010, 1, 1); | |
//in DST | |
var b:Date = new Date(2010, 7, 1); | |
var observesDST:Boolean = true; | |
if (a.timezoneOffset == b.timezoneOffset) | |
{ | |
observesDST = false; | |
} | |
var timezone:String = "ET";//Default to Eastern | |
switch (a.timezoneOffset / 60) | |
{ | |
case 10: | |
timezone = "HI"; //Hawaii | |
break; | |
case 9: | |
timezone = "AK"; //Alaska | |
break; | |
case 8: | |
timezone = "PT";//Pacific | |
break; | |
case 7: | |
timezone = "MT";//Mountain | |
break; | |
case 6: | |
timezone = "CT";//Central | |
break; | |
} | |
if (timezone == "MT" && !observesDST) | |
{ | |
timezone = "AZ";//Arizona | |
} | |
trace(timezone); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment