Android Question Timezone

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

Just trying to work out how to get the time for UTC +9.30 timezone as an example ?

I have used the following code but the time is 1/2 hour out.

B4X:
Dim lNow As Long
    DateTime.SetTimeZone("9.30")
    lNow = DateTime.Now
    DateTime.DateFormat = "dd MMM yyyy - h:mma"
    Log(DateTime.Date(lNow))

If I change the setimezone to 9.50 then it shows the correct time:
B4X:
DateTime.SetTimeZone("9.50")

Should I be setting the timezone as UTC+9.50 for when the timezone is UTC+9.30 or am I doing this wrong ?
 

aaronk

Well-Known Member
Licensed User
Longtime User
What about time zones that are xx.45 ?

When I do it as 12.45 (for UTC+12.45) it also shows the time wrong.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
12:45 o´clock in a mathematical manner should be notated as 12.75
9:30 should be 9.5

Try it this way
 
Upvote 0
Top