DateTimeOffset.Minute 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得目前 DateTimeOffset 物件所代表的時間的微分量。
public:
property int Minute { int get(); };
public int Minute { get; }
member this.Minute : int
Public ReadOnly Property Minute As Integer
屬性值
當前物體的 DateTimeOffset 微分量,以0到59之間的整數表示。
範例
以下範例以三種不同方式顯示物 DateTimeOffset 體的微分量:
透過取得 Minute 屬性的值。
方法是用「m」格式標示符呼叫該 ToString(String) 方法。
方法是用「mm」格式指定符呼叫該 ToString(String) 方法。
DateTimeOffset theTime = new DateTimeOffset(2008, 5, 1, 10, 3, 0,
DateTimeOffset.Now.Offset);
Console.WriteLine("The minute component of {0} is {1}.",
theTime, theTime.Minute);
Console.WriteLine("The minute component of {0} is{1}.",
theTime, theTime.ToString(" m"));
Console.WriteLine("The minute component of {0} is {1}.",
theTime, theTime.ToString("mm"));
// The example produces the following output:
// The minute component of 5/1/2008 10:03:00 AM -08:00 is 3.
// The minute component of 5/1/2008 10:03:00 AM -08:00 is 3.
// The minute component of 5/1/2008 10:03:00 AM -08:00 is 03.
let theTime = DateTimeOffset(2008, 5, 1, 10, 3, 0, DateTimeOffset.Now.Offset)
printfn $"The minute component of {theTime} is {theTime.Minute}."
printfn $"""The minute component of {theTime} is{theTime.ToString " m"}."""
printfn $"The minute component of {theTime} is {theTime:mm}."
// The example produces the following output:
// The minute component of 5/1/2008 10:03:00 AM -08:00 is 3.
// The minute component of 5/1/2008 10:03:00 AM -08:00 is 3.
// The minute component of 5/1/2008 10:03:00 AM -08:00 is 03.
Dim theTime As New DateTimeOffset(#5/1/2008 10:03AM#, _
DateTimeOffset.Now.Offset)
Console.WriteLine("The minute component of {0} is {1}.", _
theTime, theTime.Minute)
Console.WriteLine("The minute component of {0} is{1}.", _
theTime, theTime.ToString(" m"))
Console.WriteLine("The minute component of {0} is {1}.", _
theTime, theTime.ToString("mm"))
' The example produces the following output:
' The minute component of 5/1/2008 10:03:00 AM -08:00 is 3.
' The minute component of 5/1/2008 10:03:00 AM -08:00 is 3.
' The minute component of 5/1/2008 10:03:00 AM -08:00 is 03.
備註
你也可以透過呼叫帶有「m」或「mm」自訂格式規格的方法,ToString建立物件微分量的字串表示DateTimeOffset。