DateTimeKind 枚举

定义

指定 DateTime 对象是表示本地时间、协调通用时间 (UTC),还是既不指定为本地时间,也不指定为 UTC。Specifies whether a DateTime object represents a local time, a Coordinated Universal Time (UTC), or is not specified as either local time or UTC.

public enum class DateTimeKind
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum DateTimeKind
type DateTimeKind = 
Public Enum DateTimeKind
继承
DateTimeKind
属性

字段

Local 2

表示的时间为本地时间。The time represented is local time.

Unspecified 0

表示的时间既未指定为本地时间,也未指定为协调通用时间 (UTC)。The time represented is not specified as either local time or Coordinated Universal Time (UTC).

Utc 1

表示的时间为 UTC。The time represented is UTC.

注解

DateTimeKind枚举的成员DateTime.Kind由属性返回。A member of the DateTimeKind enumeration is returned by the DateTime.Kind property.

DateTimeKind枚举的成员用于本地时间与协调世界时 (UTC) 之间的转换操作, 但不用于比较或算术运算。The members of the DateTimeKind enumeration are used in conversion operations between local time and Coordinated Universal Time (UTC), but not in comparison or arithmetic operations. 有关时间转换的详细信息, 请参阅在时区之间转换时间For more information about time conversions, see Converting Times Between Time Zones.

适用于