Udostępnij za pośrednictwem


TimeHelpers Class

 

Provides methods to help you work with time. Configuration Manager uses several different types of time internally. This class encapsulates many of them.

Supported time formats include: ISO 8601, CIM time (also called SMS time in the some of the methods and properties in this class), FILETIME, SystemTime, "SMS Cookie" time, and CTime/time_t/UNIX time. Conversion to and from these formats is supported in most cases.

Namespace:   Microsoft.ConfigurationManagement.Messaging.Framework
Assembly:  Microsoft.ConfigurationManagement.Messaging (in Microsoft.ConfigurationManagement.Messaging.dll)

Inheritance Hierarchy

System.Object
  Microsoft.ConfigurationManagement.Messaging.Framework.TimeHelpers

Syntax

[SerializableAttribute]
public static class TimeHelpers
[SerializableAttribute]
[ExtensionAttribute]
public ref class TimeHelpers abstract sealed 
<SerializableAttribute>
<ExtensionAttribute>
Public NotInheritable Class TimeHelpers

Properties

Name Description
System_CAPS_pubpropertySystem_CAPS_static CurrentDateTimeAsSmsTime

Generates a DateTime object as a CIM-formatted string.

System_CAPS_pubpropertySystem_CAPS_static CurrentTimeAsIso8601

Gets the current time in ISO 8601 format.

System_CAPS_pubpropertySystem_CAPS_static CurrentTimeAsUnixTime

Gets the current time as Unix ctime.

Methods

Name Description
System_CAPS_pubmethodSystem_CAPS_static ParseCTime(Int64)

Converts time from a CTime object to a DateTime object.

System_CAPS_pubmethodSystem_CAPS_static ParseIso8601Time(String)

Converts time from the string date format to a DateTime object.

System_CAPS_pubmethodSystem_CAPS_static ParseIso8601Time(String, Boolean)

Converts time from the string date format to DateTime.

System_CAPS_pubmethodSystem_CAPS_static ParseSmsCookieTime(String)

Converts time from cookie time format to a DateTime object.

System_CAPS_pubmethodSystem_CAPS_static ParseSmsTime(String)

Converts time from string CIM_DATETIME format to a DateTime object.

System_CAPS_pubmethodSystem_CAPS_static ToComFileTime(DateTime)

Converts a DateTime object as local time to a COM FILETIME object. For UTC conversion, use ToComFileTime(DateTime, Boolean).

System_CAPS_pubmethodSystem_CAPS_static ToComFileTime(DateTime, Boolean)

Converts a DateTime object to a COM FILETIME object.

System_CAPS_pubmethodSystem_CAPS_static ToCTime(DateTime)

Converts a DateTime object to Unix ctime.

System_CAPS_pubmethodSystem_CAPS_static ToCTime(DateTime, Boolean)

Converts a DateTime object to Unix ctime.

System_CAPS_pubmethodSystem_CAPS_static ToCTime(Nullable<DateTime>)

Converts a DateTime object to Unix ctime.

System_CAPS_pubmethodSystem_CAPS_static ToCTime(Nullable<DateTime>, Boolean)

Converts a DateTime object to Unix ctime.

System_CAPS_pubmethodSystem_CAPS_static ToDateTime(FILETIME)

Converts a FILETIME object represented as local time to a managed DateTime object. For UTC conversion, use ToDateTime(FILETIME, Boolean).

System_CAPS_pubmethodSystem_CAPS_static ToDateTime(FILETIME, Boolean)

Converts a FILETIME object to a managed DateTime object.

System_CAPS_pubmethodSystem_CAPS_static ToIso8601Time(DateTime)

Converts an existing DateTime object to ISO 8601 format.

System_CAPS_pubmethodSystem_CAPS_static ToSmsCookieTime(DateTime)

Converts an existing DateTime object to the SMS cookie time format: 2007-01-01 11:11:11.000.

System_CAPS_pubmethodSystem_CAPS_static ToSmsTime(DateTime)

Converts a DateTime object to an SMS-formatted string.

System_CAPS_pubmethodSystem_CAPS_static ToSmsTime(DateTime, Boolean)

Converts a DateTime object to a CIM-formatted string.

System_CAPS_pubmethodSystem_CAPS_static ToSmsTime(DateTime, Int32)

Converts a DateTime object to a CIM-formatted string. Override with a specific offset.

System_CAPS_pubmethodSystem_CAPS_static ToSmsTime(DateTime, SmsTimeZone)

Converts a DateTime object to a CIM-formatted string.

System_CAPS_pubmethodSystem_CAPS_static ToSmsTime(DateTime, SmsTimeZone, Boolean, Int32)

Formats CIM time to a string. For example: '20070402184502.000000-420'.

System_CAPS_pubmethodSystem_CAPS_static ToSystemTime(DateTime)

Converts a DateTime object to a SystemTime representation.

Fields

Name Description
System_CAPS_pubfieldSystem_CAPS_static Epoch

Unix ctime epoch DateTime.

Thread Safety

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Microsoft.ConfigurationManagement.Messaging.Framework Namespace

Return to top