I am reading a timestamp and length that is in Epoch (UDT). I can't for the life of me come up with the correct result. I am setting the StartTime manually in this example, but normally it comes from a JSON file. This sample number is an actual number I pulled from the file.
For example:
I ran 1328461200 through an online Epoch converter and it came up with:
Which is what it should be. I expect the output to say 11:00 AM to 11:30 AM and instead it comes up with 2:01 AM to 2:01 AM.
If I change the format to include the date....
...then it comes up with 01/16/1970 2:01 AM to 01/16/1970 2:01 AM.
Clearly I am missing something basic here. :sign0104:
I would like it to return the correct time regardless of timezone or DST. Unfortunately I can't even get it in the right decade!
For example:
B4X:
Dim StartTime, EndTime, RunTime As Long
Dim StartTimeText, EndTimeText
StartTime = 1328461200
RunTime = 1800
EndTime = StartTime+RunTime
DateTime.TimeFormat = "h:mm a"
StartTimeText = DateTime.Time (StartTime)
EndTimeText = DateTime.Time (EndTime)
Msgbox (StartTimeText & " to " & EndTimeText,"")
I ran 1328461200 through an online Epoch converter and it came up with:
GMT: Sun, 5 Feb 2012 17:00:00 UTC
Your time zone: Sunday, February 05, 2012 11:00:00 AM GMT-6
Which is what it should be. I expect the output to say 11:00 AM to 11:30 AM and instead it comes up with 2:01 AM to 2:01 AM.
If I change the format to include the date....
B4X:
DateTime.TimeFormat = "MM/dd/yyyy h:mm a"
...then it comes up with 01/16/1970 2:01 AM to 01/16/1970 2:01 AM.
Clearly I am missing something basic here. :sign0104:
I would like it to return the correct time regardless of timezone or DST. Unfortunately I can't even get it in the right decade!