DateTimeFormatInfo.AMDesignator 屬性

定義

取得或設定 "ante meridiem" (正午以前) 小時的字串指示項。Gets or sets the string designator for hours that are "ante meridiem" (before noon).

public:
 property System::String ^ AMDesignator { System::String ^ get(); void set(System::String ^ value); };
public string AMDesignator { get; set; }
member this.AMDesignator : string with get, set
Public Property AMDesignator As String

屬性值

"ante meridiem" (正午以前) 小時的字串指示項。The string designator for hours that are ante meridiem. InvariantInfo 的預設值為 "AM"。The default for InvariantInfo is "AM".

例外狀況

正在將屬性設定為 nullThe property is being set to null.

正在設定屬性,而且 DateTimeFormatInfo 物件為唯讀。The property is being set and the DateTimeFormatInfo object is read-only.

備註

AMDesignator屬性用於從0:00:00 (午夜)到11:59:59.999 的所有時間。The AMDesignator property is used for all times from 0:00:00 (midnight) to 11:59:59.999.

如果自訂格式字串包含 "tt" 格式規範,而時間早于中午,則DateTime.ToStringToString方法會在結果字串中AMDesignator包含屬性的值,以取代 "tt"。If a custom format string includes the "tt" format specifier and the time is before noon, the DateTime.ToString or ToString method includes the value of the AMDesignator property in place of "tt" in the result string. 如果自訂格式字串包含 "t" 自訂格式規範,則只會包含AMDesignator屬性值的第一個字元。If the custom format string includes the "t" custom format specifier, only the first character of the AMDesignator property value is included. 您應該使用 "tt" 來表示需要維護其間區別的語言You should use "tt" for languages for which it is necessary to maintain the distinction between A.M. 和下午and P.M. 例如,日文,其中的 A.M。An example is Japanese, in which the A.M. 和下午and P.M. 第二個字元的指示符號不同,而不是第一個字元。designators differ in the second character instead of the first character.

適用于不使用 A.M. 的文化特性For cultures that do not use an A.M. 指示項,此屬性會傳回空字串。designator, this property returns an empty string.

適用於

另請參閱