aaronk Well-Known Member Licensed User Longtime User Sep 27, 2020 #1 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 ?
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 ?
Erel B4X founder Staff member Licensed User Longtime User Sep 27, 2020 #2 SetTimeZone expects a number = number of hours, not a string. You should pass 9.5. Upvote 0
aaronk Well-Known Member Licensed User Longtime User Sep 27, 2020 #3 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
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.
DonManfred Expert Licensed User Longtime User Sep 27, 2020 #4 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
aaronk Well-Known Member Licensed User Longtime User Sep 27, 2020 #5 DonManfred said: Try it this way Click to expand... That did the trick. Upvote 0