I can’t seem to get the correct time and date (2018-03-31 19:10:55) using the Xojo.Core.Date class and I’m sure it’s because I’m using the constructor incorrectly.
Using the timestamp value from the JSON yields 2018-03-31 21:10:55
dim tz as new Xojo.Core.TimeZone("Europe/Paris")
dim d as new Xojo.Core.Date(1522523455, tz)
Using dstStart yields 2018-03-25 03:00:00
dim tz as new Xojo.Core.TimeZone("Europe/Paris")
dim d as new Xojo.Core.Date(1521939600, tz)
Using dstEnd yields 2018-10-28 02:00:00
dim tz as new Xojo.Core.TimeZone("Europe/Paris")
dim d as new Xojo.Core.Date(1540688400, tz)
The best I can get is two hours out. What am I doing wrong here? Can anyone help?
While this might fix it mathematically, it does not explain why the api reports Paris local time plus two additional hours. The offset indicates that Paris local time in summer time is GMT + 2, looks like a bug to me.
I’ve settled on this approach which seems to work:
dim t as Text = "2018-03-31 19:10:55" ' Pulled from the "formatted" JSON key
try
dim d as Xojo.Core.Date = Xojo.Core.Date.FromText( t )
catch
' Fail
end try
[quote=380468:@Garry Pettet]Do you think the bug is with Xojo or the API?
I’ve settled on this approach which seems to work:
dim t as Text = "2018-03-31 19:10:55" ' Pulled from the "formatted" JSON key
try
dim d as Xojo.Core.Date = Xojo.Core.Date.FromText( t )
catch
' Fail
end try[/quote]