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 物件表示 Coordinated Universal Time (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.