Win32 Classes


Win32_UTCTime Class

The Win32_UTCTimeWMI class describes a point in time that is returned as Win32_UTCTime objects that result from a query. These are returned as the value for the TargetInstance property in the __InstanceModificationEvent system class. The Hour property is returned as the Coordinated Universal Time (UTC) time on a 24–hour clock.

Note  The smallest time segment supported is a second.

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_UTCTime : Win32_CurrentTime
{
  uint32 Day;
  uint32 DayOfWeek;
  uint32 Hour;
  uint32 Milliseconds;
  uint32 Minute;
  uint32 Month;
  uint32 Quarter;
  uint32 Second;
  uint32 WeekInMonth;
  uint32 Year;
};

Methods

The Win32_UTCTime class does not define any methods.

Properties

The Win32_UTCTime class defines the following properties.

Day
Data type: uint32
Access type: Read-only

Current day that matches the query (1–31).

DayOfWeek
Data type: uint32
Access type: Read-only

Current day of the current week that matches the query (0–6). By convention, the value 0 (zero) is always Sunday, regardless of the culture or the locale set on the machine.

Hour
Data type: uint32
Access type: Read-only

Current hour of the current day (0–23).

Milliseconds
Data type: uint32
Access type: Read-only

Not implemented.

Minute
Data type: uint32
Access type: Read-only

Current minute (0–59).

Month
Data type: uint32
Access type: Read-only

Current month that matches the query (1–12).

Quarter
Data type: uint32
Access type: Read-only

Current quarter of the current year (1–4).

Second
Data type: uint32
Access type: Read-only

Current second of the current minute (0–59).

WeekInMonth
Data type: uint32
Access type: Read-only

Current week in the current month (1–6).

Year
Data type: uint32
Access type: Read-only

Current year matching the query (4 digits).

Remarks

When you subscribe to events by using this class, you can create sophisticated schedules that can be implemented through events returned from WMI. For example, you can subscribe to an event for a specific day of the week in a specific quarter of a specific year. However, for schedules, the Win32_LocalTime class is more commonly used—unless UTC time is required.

The following query example shows you how to generate an event every Friday morning at 8:00:00 (UTC time) during the entire year of 2001. However, if the line "AND TargetInstance.Second=0" is removed, then the query generates 60 notifications between 8:00:00 and 8:01:00, every Friday morning in 2001.

SELECT * FROM __InstanceModificationEvent
WHERE
    TargetInstance ISA "Win32_UTCTime" 
    AND TargetInstance.Year = 2001 
    AND TargetInstance.DayOfWeek=5 
    AND TargetInstance.Hour=8 
    AND TargetInstance.Minute=0 
    AND TargetInstance.Second=0

The following query example shows you how to generate events every second forever.

SELECT * FROM __InstanceModificationEvent
WHERE
    TargetInstance ISA "Win32_UTCTime"

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.

Requirements

Minimum supported clientWindows XP
Minimum supported serverWindows Server 2003
MOFWmitimep.mof
DLLWmitimep.dll
Namespace\root\cimv2

See Also

Operating System Classes
Creating a Timer Event with Win32_LocalTime or Win32_UTCTime
Win32_LocalTime
Win32_CurrentTime

Send comments about this topic to Microsoft

Build date: 11/3/2009

Tags :


Page view tracker