DateTime.SpecifyKind Method
Assembly: mscorlib (in mscorlib.dll)
public static DateTime SpecifyKind ( DateTime value, DateTimeKind kind )
public static function SpecifyKind ( value : DateTime, kind : DateTimeKind ) : DateTime
Parameters
- value
A DateTime object.
- kind
One of the DateTimeKind values.
Return Value
A new DateTime object consisting of the same time represented by the value parameter and the DateTimeKind value specified by the kind parameter.A DateTime object consists of a Kind field that indicates whether the time value is based on local time, Coordinated Universal Time (UTC), or neither, and a Ticks field that contains a time value measured in 100-nanosecond ticks. The SpecifyKind method creates a new DateTime object using the specified kind parameter and the original time value.
The SpecifyKind method is useful in interoperability scenarios where you receive a DateTime object with an unspecified Kind field, but you can determine by independent means that the Ticks field represents local time or UTC.
The following code example uses the SpecifyKind method to demonstrate how the Kind property influences the ToLocalTime and ToUniversalTime conversion methods.
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.