DateTimeOffset.Minute Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает минутный компонент времени, представленного текущим 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.
Вызывая ToString(String) метод с описательом формата "m".
Вызывая ToString(String) метод с описательом формата mm.
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.
Комментарии
Свойство Minute не влияет на значение Offset свойства.
Кроме того, можно создать строковое представление DateTimeOffset минутного компонента объекта, вызвав ToString метод с пользовательскими описателями формата m или mm.