DateAndTime.Second(DateTime) Metod

Definition

Returnerar ett heltalsvärde från 0 till 59 som representerar sekunden i minuten.

public:
 static int Second(DateTime TimeValue);
public static int Second(DateTime TimeValue);
static member Second : DateTime -> int
Public Function Second (TimeValue As DateTime) As Integer

Parametrar

TimeValue
DateTime

Required. Ett Date värde som du vill extrahera det andra från.

Returer

Ett heltalsvärde från 0 till 59 som representerar sekunden i minuten.

Exempel

I följande exempel används Second funktionen för att hämta den andra minuten från en angiven tid. I utvecklingsmiljön visas tidslitteralen i kort tidsformat med hjälp av kodens språkinställningar.

Dim thisTime As Date
Dim thisSecond As Integer
thisTime = #4:35:17 PM#
thisSecond = Second(thisTime)
' thisSecond now contains 17.

Kommentarer

Du kan också hämta den andra minuten genom att DatePart anropa DateInterval.Second och ange för Interval argumentet.

Gäller för

Se även