Sub Activity_Create(FirstTime As Boolean)
Dim tim,utc As Long
Dim tz As Double
tim = DateTime.Now 'Get current local time
tz = DateTime.TimeZoneOffset 'Get hours offset from Greenwich
DateTime.SetTimeZone(0) 'Set clock to Greenwich time
utc = DateTime.Now 'Grab the time in Greenwich
'DateTime.SetTimeZone(tz) 'Set the clock back to local time
Msgbox(DateTime.Time(tim) & CRLF & DateTime.Time(utc),"")
End Sub
I believe this code should store current time in variable tim, and Greenwich time in utc. However, both times display as UTC time. Also, if you uncomment the line that sets the time zone back, both variables display as local time. My goal is to get local time in ticks into one long variable, and UTC time into another long variable, so I can work with both in some astronomical calculations. No matter what I try, I'm unable to figure a workaround at this point.
Suggestion... It would be ideal if there was simply DateTime.UTC as a function that would return UTC time without having to mess with the timezone offset, or to have to adjust the local time clock.