Redigera

Dela via


DateAndTime.Second(DateTime) Method

Definition

Returns an integer value from 0 through 59 representing the second of the minute.

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

Parameters

TimeValue
DateTime

Required. A Date value from which you want to extract the second.

Returns

An integer value from 0 through 59 representing the second of the minute.

Examples

The following example uses the Second function to obtain the second of the minute from a specified time. In the development environment, the time literal is displayed in short time format using the locale settings of your code.

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

Remarks

You can also obtain the second of the minute by calling DatePart and specifying DateInterval.Second for the Interval argument.

Applies to

See also