I have searched the forums, but have not come across what I'm looking for yet. I need to get the current time zone offset and daylight savings info of the user's device.
ie, if I'm in Seattle, I would need to get "-8" back as the time zone offset.
I also need to determine if daylight savings is in effect on the device or not.
DateTime.TimeZoneOffset returns the current time zone.
You can use this code to determine whether DST is currently in effect:
B4X:
Sub IsDaylightInEffect As Boolean
Dim currentTimezone As Double = DateTime.TimeZoneOffset
Dim t As Long = DateTime.Now
For i = 0 To 11 Step 2
If DateTime.GetTimeZoneOffsetAt(t) < currentTimezone Then Return True
t = t + i * DateTime.TicksPerDay * 30
Next
Return False
End Sub
DateTime.TimeZoneOffset returns the current time zone.
You can use this code to determine whether DST is currently in effect:
B4X:
Sub IsDaylightInEffect As Boolean
Dim currentTimezone As Double = DateTime.TimeZoneOffset
Dim t As Long = DateTime.Now
For i = 0 To 11 Step 2
If DateTime.GetTimeZoneOffsetAt(t) < currentTimezone Then Return True
t = t + i * DateTime.TicksPerDay * 30
Next
Return False
End Sub