JSI Tip 9005. How can I create a file of time zones, sorted from GMT -12:00 to GMT +13:00?


I have scripted TimeZones.bat to create a file of time zones, sorted from GMT -12:00 through GMT +13:00.

The syntax for using TimeZones.bat is:

TimeZones FileName

Where FileName is the file that will contain the output, like:

001 -12:00 Dateline Standard Time
002 -12:00 Dateline Daylight Time
003 -11:00 Samoa Standard Time
004 -11:00 Samoa Daylight Time
005 -10:00 Hawaiian Standard Time
006 -10:00 Hawaiian Daylight Time
007 -09:00 Alaskan Standard Time
008 -09:00 Alaskan Daylight Time
009 -08:00 Pacific Standard Time
010 -08:00 Pacific Daylight Time
011 -07:00 US Mountain Standard Time
012 -07:00 US Mountain Daylight Time
013 -07:00 Mountain Standard Time
014 -07:00 Mountain Daylight Time
015 -07:00 Mexico Standard Time 2
016 -07:00 Mexico Daylight Time 2
017 -06:00 Mexico Standard Time
018 -06:00 Mexico Daylight Time
019 -06:00 Central Standard Time
020 -06:00 Central Daylight Time
021 -06:00 Central America Standard Time
022 -06:00 Central America Daylight Time
023 -06:00 Canada Central Standard Time
024 -06:00 Canada Central Daylight Time
025 -05:00 US Eastern Standard Time
026 -05:00 US Eastern Daylight Time
027 -05:00 SA Pacific Standard Time
028 -05:00 SA Pacific Daylight Time
029 -05:00 Eastern Standard Time
030 -05:00 Eastern Daylight Time
031 -04:00 SA Western Standard Time
032 -04:00 SA Western Daylight Time
033 -04:00 Pacific SA Standard Time
034 -04:00 Pacific SA Daylight Time
035 -04:00 Atlantic Standard Time
036 -04:00 Atlantic Daylight Time
037 -03:30 Newfoundland Standard Time
038 -03:30 Newfoundland Daylight Time
039 -03:00 SA Eastern Standard Time
040 -03:00 SA Eastern Daylight Time
041 -03:00 Greenland Standard Time
042 -03:00 Greenland Daylight Time
043 -03:00 E. South America Standard Time
044 -03:00 E. South America Daylight Time
045 -02:00 Mid-Atlantic Standard Time
046 -02:00 Mid-Atlantic Daylight Time
047 -01:00 Cape Verde Standard Time
048 -01:00 Cape Verde Daylight Time
049 -01:00 Azores Standard Time
050 -01:00 Azores Daylight Time
051 +00:00 GMT Daylight Time
052 +00:00 GMT Standard Time
053 +00:00 Greenwich Daylight Time
054 +00:00 Greenwich Standard Time
055 +01:00 Central Europe Daylight Time
056 +01:00 Central Europe Standard Time
057 +01:00 Central European Daylight Time
058 +01:00 Central European Standard Time
059 +01:00 Romance Daylight Time
060 +01:00 Romance Standard Time
061 +01:00 W. Central Africa Daylight Time
062 +01:00 W. Central Africa Standard Time
063 +01:00 W. Europe Daylight Time
064 +01:00 W. Europe Standard Time
065 +02:00 E. Europe Daylight Time
066 +02:00 E. Europe Standard Time
067 +02:00 Egypt Daylight Time
068 +02:00 Egypt Standard Time
069 +02:00 FLE Daylight Time
070 +02:00 FLE Standard Time
071 +02:00 GTB Daylight Time
072 +02:00 GTB Standard Time
073 +02:00 Jerusalem Daylight Time
074 +02:00 Jerusalem Standard Time
075 +02:00 South Africa Daylight Time
076 +02:00 South Africa Standard Time
077 +03:00 Arab Daylight Time
078 +03:00 Arab Standard Time
079 +03:00 Arabic Daylight Time
080 +03:00 Arabic Standard Time
081 +03:00 E. Africa Daylight Time
082 +03:00 E. Africa Standard Time
083 +03:00 Russian Daylight Time
084 +03:00 Russian Standard Time
085 +03:30 Iran Daylight Time
086 +03:30 Iran Standard Time
087 +04:00 Arabian Daylight Time
088 +04:00 Arabian Standard Time
089 +04:00 Caucasus Daylight Time
090 +04:00 Caucasus Standard Time
091 +04:30 Afghanistan Daylight Time
092 +04:30 Afghanistan Standard Time
093 +05:00 Ekaterinburg Daylight Time
094 +05:00 Ekaterinburg Standard Time
095 +05:00 West Asia Daylight Time
096 +05:00 West Asia Standard Time
097 +05:30 India Daylight Time
098 +05:30 India Standard Time
099 +05:45 Nepal Daylight Time
100 +05:45 Nepal Standard Time
101 +06:00 Central Asia Daylight Time
102 +06:00 Central Asia Standard Time
103 +06:00 N. Central Asia Daylight Time
104 +06:00 N. Central Asia Standard Time
105 +06:00 Sri Lanka Daylight Time
106 +06:00 Sri Lanka Standard Time
107 +06:30 Myanmar Daylight Time
108 +06:30 Myanmar Standard Time
109 +07:00 North Asia Daylight Time
110 +07:00 North Asia Standard Time
111 +07:00 SE Asia Daylight Time
112 +07:00 SE Asia Standard Time
113 +08:00 China Daylight Time
114 +08:00 China Standard Time
115 +08:00 Malay Peninsula Daylight Time
116 +08:00 Malay Peninsula Standard Time
117 +08:00 North Asia East Daylight Time
118 +08:00 North Asia East Standard Time
119 +08:00 Taipei Daylight Time
120 +08:00 Taipei Standard Time
121 +08:00 W. Australia Daylight Time
122 +08:00 W. Australia Standard Time
123 +09:00 Korea Daylight Time
124 +09:00 Korea Standard Time
125 +09:00 Tokyo Daylight Time
126 +09:00 Tokyo Standard Time
127 +09:00 Yakutsk Daylight Time
128 +09:00 Yakutsk Standard Time
129 +09:30 AUS Central Daylight Time
130 +09:30 AUS Central Standard Time
131 +09:30 Cen. Australia Daylight Time
132 +09:30 Cen. Australia Standard Time
133 +10:00 AUS Eastern Daylight Time
134 +10:00 AUS Eastern Standard Time
135 +10:00 E. Australia Daylight Time
136 +10:00 E. Australia Standard Time
137 +10:00 Tasmania Daylight Time
138 +10:00 Tasmania Standard Time
139 +10:00 Vladivostok Daylight Time
140 +10:00 Vladivostok Standard Time
141 +10:00 West Pacific Daylight Time
142 +10:00 West Pacific Standard Time
143 +11:00 Central Pacific Daylight Time
144 +11:00 Central Pacific Standard Time
145 +12:00 Fiji Daylight Time
146 +12:00 Fiji Standard Time
147 +12:00 New Zealand Daylight Time
148 +12:00 New Zealand Standard Time
149 +13:00 Tonga Daylight Time
150 +13:00 Tonga Standard Time
TimeZones.bat contains:
@echo off
if \{%1\}

\{\} @echo Syntax: TimeZones Filename&goto :EOF setlocal ENABLEDELAYEDEXPANSION set file=%1 if exist %file% del /q %file% set /a cnt=1000 if exist "%TEMP%\bbb.TMP" del /q "%TEMP%\bbb.TMP" if exist "%TEMP%\ccc.TMP" del /q "%TEMP%\bbb.TMP" regedit /a "%TEMP%\aaa.TMP" "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Time Zones" for /f "Tokens=1* Delims

" %%a in ('type "%TEMP%\aaa.TMP"') do ( if %%a EQU "Display" set GMT=%%b& for /f "tokens=1,2 Delims=T)" %%i in ('@echo !GMT!') do set PM=%%j&if "!PM:~0,1!" EQU " " set PM=+00:00 if %%a EQU "Dlt" set dz=%%b if %%a EQU "Std" set tz=%%b if %%a EQU "Std" set tz=!tz:"=! if %%a EQU "Std" set dz=!dz:"=! if %%a EQU "Std" if "!PM:~0,1!" EQU "-" @echo !PM! !tz!>>"%TEMP%\bbb.TMP" if %%a EQU "Std" if "!PM:~0,1!" EQU "-" @echo !PM! !dz!>>"%TEMP%\bbb.TMP" if %%a EQU "Std" if "!PM:~0,1!" EQU "+" @echo !PM! !tz!>>"%TEMP%\ccc.TMP" if %%a EQU "Std" if "!PM:~0,1!" EQU "+" @echo !PM! !dz!>>"%TEMP%\ccc.TMP" ) sort /r "%TEMP%\bbb.TMP" /O "%TEMP%\ddd.TMP" sort "%TEMP%\ccc.TMP" /O "%TEMP%\eee.TMP" call :quiet>nul 2>&1 for /f "Tokens=1*" %%a in ('type "%TEMP%\fff.TMP"') do ( set /a cnt=!cnt! + 1 set PM=%%a if "!PM:~0,1!" EQU "-" @echo !cnt:~1! !PM! %%b>>%file% if "!PM:~0,1!" EQU "+" @echo !cnt:~1! !PM! %%b>>%file% ) del /q "%TEMP%\aaa.TMP" del /q "%TEMP%\bbb.TMP" del /q "%TEMP%\ccc.TMP" del /q "%TEMP%\ddd.TMP" del /q "%TEMP%\eee.TMP" del /q "%TEMP%\fff.TMP" endlocal goto :EOF :quiet copy "%TEMP%\ddd.TMP"+"%TEMP%\eee.TMP" "%TEMP%\fff.TMP"



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish