XmlDateTimeSerializationMode 枚举


指定在字符串与 DateTime 之间转换时,如何处理时间值。Specifies how to treat the time value when converting between string and DateTime.

public enum class XmlDateTimeSerializationMode
public enum XmlDateTimeSerializationMode
type XmlDateTimeSerializationMode = 
Public Enum XmlDateTimeSerializationMode


Local 0

作为本地时间处理。Treat as local time. 如果 DateTime 对象表示协调通用时间 (UTC),它将转换为本地时间。If the DateTime object represents a Coordinated Universal Time (UTC), it is converted to the local time.

RoundtripKind 3

转换时应保留时区信息。Time zone information should be preserved when converting.

Unspecified 2

如果 DateTime 要转换为字符串,将作为本地时间处理。Treat as a local time if a DateTime is being converted to a string. 如果正在将字符串转换为 DateTime,则在指定了时区时转换为本地时间。If a string is being converted to DateTime, convert to a local time if a time zone is specified.

Utc 1

作为 UTC 处理。Treat as a UTC. 如果 DateTime 对象表示本地时间,它将转换为 UTC。If the DateTime object represents a local time, it is converted to a UTC.


此枚举由XmlConvert.ToDateTimeXmlConvert.ToString方法使用。This enumeration is used by the XmlConvert.ToDateTime and XmlConvert.ToString methods.