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)

public static DateTime SpecifyKind(
	DateTime value,
	DateTimeKind kind
)

Parameters

value
Type: System..::..DateTime
A date and time.
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.

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 noteImportant

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.

Show: