Sub GetUsertz() As Double
Dim SQL As SQL = DBM.GetSQL
Dim tzo As List = DBM.SQLSelect(SQL,"Select * FROM users WHERE UserID = "&UserID)
Dim tz As Double = 0
If tzo.Size > 0 Then
Dim tbl As Map = tzo.Get(0)
tz = tbl.Get("usertz")
Dim dname As String = tbl.Get("username")
Username = dname
End If
DBM.CloseSQL(SQL)
If tz = 0 Then ' if user timezone was not set - set it to browser tz...
Dim script As String = $"var d = new Date();
return d.getTimezoneOffset();"$
Dim tzf As Future = page.ws.EvalWithResult(script, Null)
Log(" tzf: "& (tzf.Value / 60) )
tz = (tzf.Value / 60) * -1 ' (420 / 60 * -1 = -7)
End If
Dim tzn As String = ABM.Util.GetBrowserTimeZone(page) ' returns America/Vancouver
DateTime.SetTimeZone( tz)
Main.utz = tz
Log(" Set time zone to: "&tz&" Name: "&tzn)
Return tz
End Sub