Share via


SpecifyKind Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Creates a new DateTime object that has the same number of ticks as the specified DateTime, but is designated as either local time, Coordinated Universal Time (UTC), or neither, as indicated by the specified DateTimeKind value.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared Function SpecifyKind ( _
    value As DateTime, _
    kind As DateTimeKind _
) As DateTime
public static DateTime SpecifyKind(
    DateTime value,
    DateTimeKind kind
)
public:
static DateTime SpecifyKind(
    DateTime value, 
    DateTimeKind kind
)
static member SpecifyKind : 
        value:DateTime * 
        kind:DateTimeKind -> DateTime 
public static function SpecifyKind(
    value : DateTime, 
    kind : DateTimeKind
) : DateTime

Parameters

  • kind
    Type: System. . :: . .DateTimeKind
    One of the enumeration values that indicates whether the new object represents local time, UTC, or neither.

Return Value

Type: System. . :: . .DateTime
A new object that has the same number of ticks as the object represented by the value parameter and the DateTimeKind value specified by the kind parameter.

Remarks

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.

Important

The returned DateTime value does not represent the same instant in time as the value parameter, and SpecifyKind is not a time zone conversion method. Instead, it leaves the time specified by the value parameter unchanged, and sets the Kind property to kind.

.NET Framework Security

See Also

Reference

DateTime Structure

System Namespace