This documentation is archived and is not being maintained.

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


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.


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.


Namespace: Microsoft.VisualBasic

Module: DateAndTime

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

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