Advertisement
Guest User

Untitled

a guest
May 4th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1. var timezoneAbbreviation = function(timezoneString) {
  2. var timezoneAbbreviations = {
  3. "Afghanistan Time": "AFT",
  4. "Alaska Daylight Time": "AKDT",
  5. "Alaska Standard Time": "AKST",
  6. "Amazon Summer Time": "AMST",
  7. "Amazon Time": "AMT",
  8. "Arabia Standard Time": "AST",
  9. "Argentina Time": "ART",
  10. "Armenia Summer Time": "AMST",
  11. "Armenia Time": "AMT",
  12. "ASEAN Common Time": "ACT",
  13. "Atlantic Daylight Time": "ADT",
  14. "Atlantic Standard Time": "AST",
  15. "Australian Central Daylight Savings Time": "ACDT",
  16. "Australian Central Standard Time": "ACST",
  17. "Australian Eastern Daylight Savings Time": "AEDT",
  18. "Australian Eastern Standard Time": "AEST",
  19. "Australian Western Daylight Time": "AWDT",
  20. "Australian Western Standard Time": "AWST",
  21. "Azerbaijan Time": "AZT",
  22. "Azores Standard Time": "AZOST",
  23. "Baker Island Time": "BIT",
  24. "Bangladesh Standard Time": "BST",
  25. "Bhutan Time": "BTT",
  26. "Bolivia Time": "BOT",
  27. "Brasilia Time": "BRT",
  28. "British Indian Ocean Time": "BIOT",
  29. "British Summer Time": "BST",
  30. "Brunei Time": "BDT",
  31. "Cape Verde Time": "CVT",
  32. "Central Africa Time": "CAT",
  33. "Central Daylight Time": "CDT",
  34. "Central European Daylight Time": "CEDT",
  35. "Central European Summer Time": "CEST",
  36. "Central European Time": "CET",
  37. "Central Indonesia Time": "CIT",
  38. "Central Standard Time": "CST",
  39. "Central Summer Time": "CST",
  40. "Central Western Standard Time": "CWST",
  41. "Chamorro Standard Time": "ChST",
  42. "Chatham Daylight Time": "CHADT",
  43. "Chatham Standard Time": "CHAST",
  44. "Chile Standard Time": "CLT",
  45. "Chile Summer Time": "CLST",
  46. "China Standard Time": "CST",
  47. "China time": "CT",
  48. "Choibalsan": "CHOT",
  49. "Christmas Island Time": "CXT",
  50. "Chuuk Time": "CHUT",
  51. "Clipperton Island Standard Time": "CIST",
  52. "Cocos Islands Time": "CCT",
  53. "Colombia Summer Time": "COST",
  54. "Colombia Time": "COT",
  55. "Cook Island Time": "CKT",
  56. "Coordinated Universal Time UTC": "UTC",
  57. "Cuba Daylight Time": "CDT",
  58. "Cuba Standard Time": "CST",
  59. "Davis Time": "DAVT",
  60. "Dumont d'Urville Time": "DDUT",
  61. "East Africa Time": "EAT",
  62. "Easter Island Standard Summer Time": "EASST",
  63. "Easter Island Standard Time": "EAST",
  64. "Eastern Caribbean Time": "ECT",
  65. "Eastern Daylight Time": "EDT",
  66. "Eastern European Daylight Time": "EEDT",
  67. "Eastern European Summer Time": "EEST",
  68. "Eastern European Time": "EET",
  69. "Eastern Greenland Summer Time": "EGST",
  70. "Eastern Greenland Time": "EGT",
  71. "Eastern Indonesian Time": "EIT",
  72. "Eastern Standard Time": "EST",
  73. "Ecuador Time": "ECT",
  74. "Falkland Islands Standard Time": "FKST",
  75. "Falkland Islands Summer Time": "FKST",
  76. "Falkland Islands Time": "FKT",
  77. "Fernando de Noronha Time": "FNT",
  78. "Fiji Time": "FJT",
  79. "French Guiana Time": "GFT",
  80. "Further-eastern European Time": "FET",
  81. "Galapagos Time": "GALT",
  82. "Gambier Island Time": "GIT",
  83. "Gambier Islands": "GAMT",
  84. "Georgia Standard Time": "GET",
  85. "Gilbert Island Time": "GILT",
  86. "Greenwich Mean Time UTC": "GMT",
  87. "Gulf Standard Time": "GST",
  88. "Guyana Time": "GYT",
  89. "Hawaii Standard Time": "HST",
  90. "Hawaii-Aleutian Daylight Time": "HADT",
  91. "Hawaii-Aleutian Standard Time": "HAST",
  92. "Heard and McDonald Islands Time": "HMT",
  93. "Heure Avancée d'Europe Centrale": "HAEC",
  94. "Hong Kong Time": "HKT",
  95. "Indian Ocean Time": "IOT",
  96. "Indian Standard Time": "IST",
  97. "Indian/Kerguelen": "TFT",
  98. "Indochina Time": "ICT",
  99. "Iran Daylight Time": "IRDT",
  100. "Iran Standard Time": "IRST",
  101. "Irish Standard Time": "IST",
  102. "Irkutsk Time": "IRKT",
  103. "Israel Daylight Time": "IDT",
  104. "Israel Standard Time": "IST",
  105. "Japan Standard Time": "JST",
  106. "Kaliningrad Time": "USZ1",
  107. "Kamchatka Time": "PETT",
  108. "Khovd Time": "HOVT",
  109. "Korea Standard Time": "KST",
  110. "Kosrae Time": "KOST",
  111. "Krasnoyarsk Time": "KRAT",
  112. "Kyrgyzstan time": "KGT",
  113. "Line Islands Time": "LINT",
  114. "Lord Howe Standard Time": "LHST",
  115. "Lord Howe Summer Time": "LHST",
  116. "Macquarie Island Station Time": "MIST",
  117. "Magadan Time": "MAGT",
  118. "Malaysia Standard Time": "MST",
  119. "Malaysia Time": "MYT",
  120. "Maldives Time": "MVT",
  121. "Marquesas Islands Time": "MART",
  122. "Marshall Islands": "MHT",
  123. "Mauritius Time": "MUT",
  124. "Mawson Station Time": "MAWT",
  125. "Middle European Saving Time": "MEST",
  126. "Middle European Time": "MET",
  127. "Moscow Time": "MSK",
  128. "Mountain Daylight Time": "MDT",
  129. "Mountain Standard Time": "MST",
  130. "Myanmar Standard Time": "MST",
  131. "Myanmar Time": "MMT",
  132. "Nepal Time": "NPT",
  133. "New Caledonia Time": "NCT",
  134. "New Zealand Daylight Time": "NZDT",
  135. "New Zealand Standard Time": "NZST",
  136. "Newfoundland Daylight Time": "NDT",
  137. "Newfoundland Standard Time": "NST",
  138. "Newfoundland Time": "NT",
  139. "Niue Time": "NUT",
  140. "Norfolk Time": "NFT",
  141. "Omsk Time": "OMST",
  142. "Oral Time": "ORAT",
  143. "Pacific Daylight Time": "PDT",
  144. "Pacific Standard Time": "PST",
  145. "Pakistan Standard Time": "PKT",
  146. "Papua New Guinea Time": "PGT",
  147. "Paraguay Summer Time": "PYST",
  148. "Paraguay Time": "PYT",
  149. "Peru Time": "PET",
  150. "Philippine Standard Time": "PST",
  151. "Phoenix Island Time": "PHOT",
  152. "Pohnpei Standard Time": "PONT",
  153. "Rothera Research Station Time": "ROTT",
  154. "Réunion Time": "RET",
  155. "Saint Pierre and Miquelon Daylight Time": "PMDT",
  156. "Saint Pierre and Miquelon Standard Time": "PMST",
  157. "Sakhalin Island time": "SAKT",
  158. "Samara Time": "SAMT",
  159. "Samoa Standard Time": "SST",
  160. "Seychelles Time": "SCT",
  161. "Showa Station Time": "SYOT",
  162. "Singapore Standard Time": "SST",
  163. "Singapore Time": "SGT",
  164. "Solomon Islands Time": "SBT",
  165. "South African Standard Time": "SAST",
  166. "South Georgia and the South Sandwich Islands": "GST",
  167. "Srednekolymsk Time": "SRET",
  168. "Sri Lanka Time": "SLST",
  169. "Suriname Time": "SRT",
  170. "Tahiti Time": "TAHT",
  171. "Tajikistan Time": "TJT",
  172. "Thailand Standard Time": "THA",
  173. "Timor Leste Time": "TLT",
  174. "Tokelau Time": "TKT",
  175. "Tonga Time": "TOT",
  176. "Turkmenistan Time": "TMT",
  177. "Tuvalu Time": "TVT",
  178. "Ulaanbaatar Time": "ULAT",
  179. "Uruguay Standard Time": "UYT",
  180. "Uruguay Summer Time": "UYST",
  181. "Uzbekistan Time": "UZT",
  182. "Vanuatu Time": "VUT",
  183. "Venezuelan Standard Time": "VET",
  184. "Vladivostok Time": "VLAT",
  185. "Volgograd Time": "VOLT",
  186. "Vostok Station Time": "VOST",
  187. "Wake Island Time": "WAKT",
  188. "West Africa Summer Time": "WAST",
  189. "West Africa Time": "WAT",
  190. "Western European Daylight Time": "WEDT",
  191. "Western European Summer Time": "WEST",
  192. "Western European Time UTC": "WET",
  193. "Western Indonesian Time": "WIT",
  194. "Western Standard Time": "WST",
  195. "Yakutsk Time": "YAKT",
  196. "Yekaterinburg Time": "YEKT",
  197. "Zulu Time": "Z"
  198. };
  199. return timezoneAbbreviations[timezoneString] || timezoneString;
  200. };
  201.  
  202. var getTimezoneAbbreviation = function(date) {
  203. var match;
  204. date = date.toString();
  205. // Wed Feb 29 2012 00:00:00 GMT-0800 (Pacific Standard Time)
  206. // Wed Feb 29 2012 00:00:00 GMT-0800 (PST)
  207. if (match = date.match(/\((.+)\)/)) {
  208. return timezoneAbbreviation(match[1].valueOf());
  209. }
  210. // Wed Feb 29 00:00:00 PST 2012
  211. else if (match = date.match(/\d{2}:\d{2}:\d{2}\s(\w{1,5})\s/)) {
  212. return match[1].valueOf();
  213. }
  214. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement