DateTimeOffset.Second Eigenschap

Definitie

Hiermee wordt het tweede onderdeel van de kloktijd opgehaald die wordt vertegenwoordigd door het huidige DateTimeOffset object.

public:
 property int Second { int get(); };
public int Second { get; }
member this.Second : int
Public ReadOnly Property Second As Integer

Waarde van eigenschap

Het tweede onderdeel van het DateTimeOffset object, uitgedrukt als een geheel getal tussen 0 en 59.

Voorbeelden

In het volgende voorbeeld wordt het tweede onderdeel van een DateTimeOffset object op drie verschillende manieren weergegeven:

  • Door de waarde van de Second eigenschap op te halen.

  • Door de ToString(String) methode aan te roepen met de notatieaanduiding 's'.

  • Door de ToString(String) methode aan te roepen met de notatieaanduiding 'ss'.

DateTimeOffset theTime = new DateTimeOffset(2008, 6, 12, 21, 16, 32,
                             DateTimeOffset.Now.Offset);
Console.WriteLine("The second component of {0} is {1}.",
                  theTime, theTime.Second);

Console.WriteLine("The second component of {0} is{1}.",
                  theTime, theTime.ToString(" s"));

Console.WriteLine("The second component of {0} is {1}.",
                  theTime, theTime.ToString("ss"));
// The example produces the following output:
//    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
//    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
//    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
let theTime = DateTimeOffset(2008, 6, 12, 21, 16, 32, DateTimeOffset.Now.Offset)
printfn $"The second component of {theTime} is {theTime.Second}."

printfn $"""The second component of {theTime} is{theTime.ToString " s"}."""

printfn $"The second component of {theTime} is {theTime:ss}."

// The example produces the following output:
//    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
//    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
//    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
Dim theTime As New DateTimeOffset(#6/12/2008 9:16:32PM#, _
                                       DateTimeOffset.Now.Offset)
Console.WriteLine("The second component of {0} is {1}.", _
                  theTime, theTime.Second)

Console.WriteLine("The second component of {0} is{1}.", _
                  theTime, theTime.ToString(" s"))

Console.WriteLine("The second component of {0} is {1}.", _
                  theTime, theTime.ToString("ss"))
' The example produces the following output:
'    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
'    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.
'    The second component of 6/12/2008 9:16:32 PM -07:00 is 32.

Opmerkingen

De Second eigenschap wordt niet beïnvloed door de waarde van de Offset eigenschap.

U kunt ook een tekenreeksweergave van het tweede onderdeel van een DateTimeOffset object maken door de ToString methode aan te roepen met de aangepaste notatieaanduidingen 's' of 'ss'.

Van toepassing op