Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
October 28, 2003
The Resource Kits contain Timezone.exe, the Daylight Saving Time Update Utility. You can also download Timezone.exe.
When you type timezone /?, you receive:
Daylight Saving Time Update UtilityCopyright Microsoft Corporation 1997. All rights reservedTIMEZONE [/?] [/g | /s StartDate EndDate] /?: Command line help /g: Get the current timezone /s: Set a new timezone StartDate: Date that Daylight Saving Time begins EndDate: Date that Daylight Saving Time ends StartDate and EndDate use format: Hour:DayOfWeek:Day:Month Hour: 00-23 (specifies the hour) DayOfWeek: 0-6 (specifies the day of the week; Sunday = 0, Monday = 1, and so on) Day : 1-5 (specifies the occurrence of day in the month; 1 = first occurrence of day, 2 = second occurrence of day, ..., 5 = last occurrence of day) (if DayOfWeek is Sunday, then 1 = first Sunday, 4 = fourth Sunday, 5 = last Sunday) Month: 01-12 (specifies the month; January = 1, February = 2, and so on)Example: TIMEZONE /s 02:0:5:04 02:2:1:10 Timezone will be changed to: Daylight Saving Time begins at 2:00 on last Sunday in April (02:0:5:04) Daylight Saving Time ends at 2:00 on forth Tuesday in October (02:2:4:10)
When you type timezone /g, you receive a display similar to:
Current Timezone is : Daylight Saving Time begins at 02:0:1:04 Daylight Saving Time ends at 02:0:5:10
If you wanted to parse this information in a batch script, you could:
for /f "Skip=1 Tokens=4,6-9 Delims=: " %%s in ('timezone /g') do if /i "%%s" EQU "begins" ( set shr=%%t&set sdow=%%u&set sday=%%v&set smon=%%w ) ELSE ( set ehr=%%t&set edow=%%u&set eday=%%v&set emon=%%w )
You May Also Like