Export (0) Print
Expand All

ManagementDateTimeConverter.ToDmtfDateTime Method

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Converts a given DateTime object to DMTF format.

[Visual Basic]
Public Shared Function ToDmtfDateTime( _
   ByVal date As DateTime _
) As String
[C#]
public static string ToDmtfDateTime(
 DateTime date
);
[C++]
public: static String* ToDmtfDateTime(
 DateTime date
);
[JScript]
public static function ToDmtfDateTime(
   date : DateTime
) : String;

Parameters

date
A DateTime object representing the datetime to be converted to DMTF datetime.

Return Value

A string that represents the DMTF datetime for the given DateTime object.

Remarks

Date and time in WMI is represented in DMTF datetime format. This format is explained in WMI SDK documentation. The DMTF datetime string represented will be with respect to the UTC offset of the current timezone. The lowest precision in DMTF is microseconds and in DateTime is Ticks, which is equivalent to 100 of nanoseconds. During conversion these Ticks are converted to microseconds and rounded off to the the nearest microsecond.

Example

[C#] 
// Convert the current time in System.DateTime to DMTF format
string dmtfDateTime = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now);
   
[Visual Basic] 
' Convert the current time in System.DateTime to DMTF format
Dim dmtfDateTime as String = ManagementDateTimeConverter.ToDmtfDateTime(DateTime.Now)
   

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ManagementDateTimeConverter Class | ManagementDateTimeConverter Members | System.Management Namespace

Show:
© 2015 Microsoft