SECOND

SECOND(time)

Returns the seconds from a given time (Integer).


timeThe time you want the second from (Variant).

REMARKS
* If "time" is Null, then Null is returned.
* You can use the HOUR function to return the hour from a time.
* You can use the MINUTE function to return the minutes from a time.
* You can use the NOW function to return the current system date and time.
* You can use the TIME function to return the current system time.
* The equivalent .NET function is Microsoft.VisualBasic.DateAndTime.Second
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print Second("09:33:7")       '= 7  
Debug.Print Second("09:34:20") '= 45
Debug.Print Second("11:15:06") '= 15
Debug.Print Second("11:15:06 AM") '= 15
Debug.Print Second("11:15:06 PM") '= 15
Debug.Print Second("22:00:00") '= 0
Debug.Print Second("1:1:1") '= 1

Dim tmTime As Variant
tmTime = #6:25:39 PM#
Debug.Print Second(tmTime) '= 39

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top