by Mark Mokoski (14 Submissions)
Category: VB function enhancement
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (13 Votes)
Updated 12-APR 2005! Add UTC time offset from Local time and formats Time / Date based on country/regional settings. Function module for getting UTC (GMT) time and date. Demo program shows how UTC functions relate to standard VB time/date functions. Being a Ham Radio and Shortwave geek, I needed UTC time a lot for logging and schedule time conversions. Comments welcome
Code Returns
Returns time or date in different formats. See code in code module
API DeclarationsPrivate Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Private Declare Function GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(32) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(32) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type