Win32 Classes


Win32_TimeZone Class

The Win32_TimeZoneWMI class represents the time zone information for a computer system running Windows, which includes the changes required for transitioning to daylight saving time transition.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties and methods are in alphabetic order, not MOF order.

Syntax

class Win32_TimeZone : CIM_Setting
{
  sint32 Bias;
  string Caption;
  sint32 DaylightBias;
  uint32 DaylightDay;
  uint8  DaylightDayOfWeek;
  uint32 DaylightHour;
  uint32 DaylightMillisecond;
  uint32 DaylightMinute;
  uint32 DaylightMonth;
  string DaylightName;
  uint32 DaylightSecond;
  uint32 DaylightYear;
  string Description;
  string SettingID;
  uint32 StandardBias;
  uint32 StandardDay;
  uint8  StandardDayOfWeek;
  uint32 StandardHour;
  uint32 StandardMillisecond;
  uint32 StandardMinute;
  uint32 StandardMonth;
  string StandardName;
  uint32 StandardSecond;
  uint32 StandardYear;
};

Methods

The Win32_TimeZone class does not define any methods.

Properties

The Win32_TimeZone class defines the following properties.

Bias
Data type: sint32
Access type: Read-only
Qualifiers: Units(Minutes)

Current bias for local time translation. The bias is the difference between Coordinated Universal Time (UTC) and local time. All translations between UTC and local time are based on the following formula: UTC = local time - bias. This property is required.

Caption
Data type: string
Access type: Read-only

Short description of the CIM_Setting object—a one-line string.

DaylightBias
Data type: sint32
Access type: Read-only
Qualifiers: Units(Minutes)

Bias value to be used during local time translations that occur during daylight saving time. This property is ignored if a value for the DaylightDay property is not supplied. The value of this property is added to the Bias property to form the bias used during daylight time. In most time zones, the value of this property is -60.

DaylightDay
Data type: uint32
Access type: Read-only

DaylightDayOfWeek of the DaylightMonth when the transition from standard time to daylight saving time occurs on this operating system.

Example: If the transition day (DaylightDayOfWeek) occurs on a Sunday, then the value "1" indicates the first Sunday of the DaylightMonth, "2" indicates the second Sunday, and so on. The value "5" indicates the last DaylightDayOfWeek in the month.

DaylightDayOfWeek
Data type: uint8
Access type: Read-only

Day of the week when the transition from standard time to daylight saving time occurs on an operating system.

ValueMeaning
0 (0x0)

Sunday

1 (0x1)

Monday

2 (0x2)

Tuesday

3 (0x3)

Wednesday

4 (0x4)

Thursday

5 (0x5)

Friday

6 (0x6)

Saturday

 

Example: 1

DaylightHour
Data type: uint32
Access type: Read-only

Hour of the day when the transition from standard time to daylight saving time occurs on an operating system.

Example: 2

DaylightMillisecond
Data type: uint32
Access type: Read-only

Millisecond of the DaylightSecond when the transition from standard time to daylight saving time occurs on an operating system.

DaylightMinute
Data type: uint32
Access type: Read-only

Minute of the DaylightHour when the transition from standard time to daylight saving time occurs on an operating system.

Example: 59

DaylightMonth
Data type: uint32
Access type: Read-only

Month when the transition from standard time to daylight saving time occurs on an operating system.

ValueMeaning
1 (0x1)

January

2 (0x2)

February

3 (0x3)

March

4 (0x4)

April

5 (0x5)

May

6 (0x6)

June

7 (0x7)

July

8 (0x8)

August

9 (0x9)

September

10 (0xA)

October

11 (0xB)

November

12 (0xC)

December

 

DaylightName
Data type: string
Access type: Read-only
Qualifiers: MaxLen(256)

Time zone being represented when daylight saving time is in effect.

Example: "EDT" (Eastern Daylight Time)

DaylightSecond
Data type: uint32
Access type: Read-only

Second of the DaylightMinute when the transition from standard time to daylight saving time occurs on an operating system.

Example: 59

DaylightYear
Data type: uint32
Access type: Read-only

Year when daylight saving time is in effect. This property is not required.

Example: 1997

Description
Data type: string
Access type: Read-only

Description of the CIM_Setting object.

SettingID
Data type: string
Access type: Read-only

Identifier for the CIM_Setting object.

StandardBias
Data type: uint32
Access type: Read-only
Qualifiers: Units(Minutes)

Bias value to use when daylight saving time is not in effect. This property is ignored if a value for StandardDay is not supplied. The value of this property is added to the Bias property to form the bias during standard time.

Example: 0

StandardDay
Data type: uint32
Access type: Read-only

StandardDayOfWeek of the StandardMonth when the transition from daylight saving time to standard time occurs on an operating system.

If the transition day (StandardDayOfWeek) occurs on a Sunday, then the value "1" indicates the first Sunday of the StandardMonth, "2" indicates the second Sunday, and so on. The value "5" indicates the last StandardDayOfWeek in the month.

StandardDayOfWeek
Data type: uint8
Access type: Read-only

Day of the week when the transition from daylight saving time to standard time occurs on an operating system.

ValueMeaning
0 (0x0)

Sunday

1 (0x1)

Monday

2 (0x2)

Tuesday

3 (0x3)

Wednesday

4 (0x4)

Thursday

5 (0x5)

Friday

6 (0x6)

Saturday

 

StandardHour
Data type: uint32
Access type: Read-only

Hour of the day when the transition from daylight saving time to standard time occurs on an operating system.

Example: 11

StandardMillisecond
Data type: uint32
Access type: Read-only

Millisecond of the StandardSecond when the transition from daylight saving time to standard time occurs on an operating system.

StandardMinute
Data type: uint32
Access type: Read-only

Minute of the StandardDay when the transition from daylight saving time to standard time occurs on an operating system.

Example: 59

StandardMonth
Data type: uint32
Access type: Read-only

Month when the transition from daylight saving time to standard time occurs on an operating system.

ValueMeaning
1 (0x1)

January

2 (0x2)

February

3 (0x3)

March

4 (0x4)

April

5 (0x5)

May

6 (0x6)

June

7 (0x7)

July

8 (0x8)

August

9 (0x9)

September

10 (0xA)

October

11 (0xB)

November

12 (0xC)

December

 

StandardName
Data type: string
Access type: Read-only
Qualifiers: Key, MaxLen(256)

Name of the time zone being represented when standard time is in effect.

Example: "EST" (Eastern Standard Time)

StandardSecond
Data type: uint32
Access type: Read-only

Second of the StandardMinute when the transition from daylight saving time to standard time occurs on an operating system.

Example: 59

StandardYear
Data type: uint32
Access type: Read-only

Year when standard time is in effect. This property is not required.

Example: 1997

Remarks

The Win32_TimeZone class is derived from CIM_Setting.

Examples

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application Examples.

The following VBScript code example displays the settings for Win32_TimeZone instances.

Dim arDayOrWeek(7)
arDayOrWeek(0) = "Sunday"
arDayOrWeek(1) = "Monday"
arDayOrWeek(2) = "Tuesday"
arDayOrWeek(3) = "Wednesday"
arDayOrWeek(4) = "Thursday"
arDayOrWeek(5) = "Friday"
arDayOrWeek(6) = "Saturday"

Dim arMonth(13)
arMonth(1) = "January"
arMonth(2) = "Feburary"
arMonth(3) = "March"
arMonth(4) = "April"
arMonth(5) = "May"
arMonth(6) = "June"
arMonth(7) = "July"
arMonth(8) = "August"
arMonth(9) = "September"
arMonth(10) = "October"
arMonth(11) = "November"
arMonth(12) = "December"

strComputer = "."
wmiQuery = "Select * from Win32_TimeZone"
Set objWMIService = GetObject("winmgmts:\\" & _
    strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery(wmiQuery)

For Each objItem in colItems
    WScript.Echo "Day of Week setting is: " _
        & objItem.dayLightDayOfWeek _
        & " which is: " & arDayOrWeek(objItem.DaylightDayOfWeek)
    WScript.Echo "Hour: " & objItem.DaylightHour 
    WScript.Echo "Month: " & objItem.DaylightMonth _
        & " which is: " & arMonth(objItem.DaylightMonth )
    WScript.Echo "Description: " & objItem.DaylightName 
    WScript.Echo "The transition from DLS to Standard occurs: " 
    WScript.Echo "Day of Week setting is: " _
        & objItem.standardDayOfWeek _
        & " which is: " & arDayOrWeek(objItem.DaylightDayOfWeek)
    WScript.Echo "Hour: " & objItem.StandardHour 
    WScript.Echo "Month: " & objItem.StandardMonth _ 
        & " which is: " & arMonth(objItem.StandardMonth )
    WScript.Echo "Description: " & objItem.StandardName 
Next

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
MOFCimwin32.mof
DLLCimwin32.dll
Namespace\root\cimv2

See Also

Operating System Classes
SWbemDateTime
Date and Time Format
WMI Tasks: Dates and Times

Send comments about this topic to Microsoft

Build date: 11/3/2009

Tags :


Page view tracker