TIME - Function

TIME()

Returns the current system time (Date).


REMARKS
* When used in the editor, brackets are not automatically removed.
* This function should be prefixed with "VBA." to make it easier to understand.
* You can use the DATE function to return the current system date.
* You can use the NOW function to return the current system date and time.
* You can use the TIME Statement statement to set the current system time.
* You can use the TIME$ function to return a String data type instead of a Variant data type.
* You can use the TIMER function to return the number of seconds elapsed since midnight.
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print VBA.Time()    '= volatile  
Debug.Print VBA.Time() '= "12:49:31"

Dim sngSerial As Single
sngSerial = VBA.Time()
Debug.Print sngSerial '= 0.5340278

Dim sTime As String
sTime = VBA.Time()
Debug.Print sTime '= "12:49:31"

Dim dtTime As Date
dtTime = VBA.Time()
Debug.Print dtTime '= "12:49:31"

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