Second Function

Returns a whole number between 0 and 59, inclusive, representing the second of the minute.

Syntax

Second(time)

Arguments:

Time: Required. Any expression that can represent time.

Supported Date Formats:

  • MM-DD-YYYY
  • MM/DD/YYYY
  • DD-MM-YYYY
  • DD/MM/YYYY
  • YYYY-MM-DD
  • YYYY/MM/DD

Supported Time Format:

hh:mm:ss

Remarks

The following example uses the Second function to return the current second:

Example 1:

Dim MySec
MySec = Second(Now)
Dim MyTime, MySecond
MyTime = "14:30:45"   
MySecond = Second(MyTime)  
'Output: 45

Example 2:

Dim MyDateTime, MySecond
MyDateTime = "21/01/2025 18:45:30"   
MySecond = Second(MyDateTime)        
'Output: 30

Example 3:

Dim MyDateTime, MySecond
MyDateTime = DateAdd("s", 30, Now)  
MySecond = Second(MyDateTime)        
'Output: If current time is 08:30:15 AM, then it returns 45