DateTimeFormatInfo.PMDesignator 屬性

定義

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

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

屬性值

"post meridiem" (正午以後) 小時的字串指示項。The string designator for hours that are "post meridiem" (after noon). InvariantInfo 的預設值為 "PM"。The default for InvariantInfo is "PM".

例外狀況

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

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

備註

PMDesignator屬性用於所有時間,從12:00:00 (中午)到23:59:59.999。The PMDesignator property is used for all times from 12:00:00 (noon) to 23:59:59.999.

如果自訂模式包含格式模式 "tt",而時間是在中午之後, DateTime.ToString則會顯示的PMDesignator值,以取代格式模式中的 "tt"。If the custom pattern includes the format pattern "tt" and the time is after noon, DateTime.ToString displays the value of PMDesignator in place of the "tt" in the format pattern. 如果自訂模式包含格式模式 "t", PMDesignator則只會顯示的第一個字元。If the custom pattern includes the format pattern "t", only the first character of PMDesignator is displayed. 您的應用程式應針對需要維護 AM 和 PM 之間區別的語言使用 "tt"。Your application should use "tt" for languages for which it is necessary to maintain the distinction between AM and PM. 其中一種就是日文,日文的 AM 和 PM 指示項的第二個字元 (非第一個字元) 不同。An example is Japanese, for which the AM and PM designators differ in the second character instead of the first character.

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

適用於

另請參閱