Visual Basic Language Reference  

Second Function

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

Public Function Second(ByVal TimeValue As DateTime) As Integer

Parameter

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

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

Example

This 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 MyTime As Date
Dim MySecond As Integer
MyTime = #4:35:17 PM#   ' Assign a time.
MySecond = Second(MyTime)   ' MySecond contains 17.

See Also

Day Function | Hour Function | Minute Function | Now Property | TimeOfDay Property | DatePart Function | System Namespace | DateTime Structure | ArgumentException Class | ArgumentOutOfRangeException Class