I am in Eastern Time Time Zone (in the USA) which is -5GMT
To get 2PM, I set wHour to 19 (2 PM = 14hr UTC , 14 + 5 (my GMT) = 19 )
My problem is, since wHour accepts values between 0-23 , How can I set up the system time to for example 7PM ( 7 PM = 19hr UTC, 19 + 5 (my GMT) = 24 ). SYSTEMTIME structure naturally rejects the value 24 for wHour.
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer ' Accepts values between 0 and 23
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
Add 5 to wHour.
'Now, we're going to use the Mod function
If NewHour >= 24 Then
wHour = NewHour Mod 24
wDay = wDay + 1
'However, what if it's the end of the month?
If wDay is endofmonth Then
'You're gonna have to check for endofmonth, as it changes per month (you can use the value for wMonth for this)
'What if it's the end of the year? (you'll need to check for leap years too)
If wDay = endofyear Then
wYear = wYear + 1