Declare Sub GetLocalTime Lib "kernel32.dll" (lpSystemTime As SYSTEMTIME)
Platforms: Win 95/98, Win NT
GetLocalTime returns the system's time and date. The various features of the time and date (month, day, hour, minute, second, etc.), down to the millisecond, are sorted in the variable passed as lpSystemTime! Windows considers "local time" to be the system's current time.
Example:
' Print the current date in mm-dd-yyyy format
Dim localtime As SYSTEMTIME ' receives the computer's time and date
GetLocalTime localtime ' read the computer's time and date
' Display the date
Debug.Print localtime.wMonth; "-"; localtime.wDay; "-"; localtime.wYear
Related Call: GetSystemTime
Category: Time
Back to the index.