I have the following timestamp: 1444288186967
.
When I put that in a Epoch Converter, I get correctly 08 Oct 2015 07:09:46 as result.
However, when I use (as mentioned in another post) the function UnixToDateTime(const AValue: Int64): TDateTime
I get 02 Sep 47737 11:02:47. Strange, isn't it?
My code (using TMS Aurelius)
Person.EndDate.Value := UnixToDateTime(FHit.TimestampUntil);
Where FHit.TimestampUntil
is an Int64
as the UnixToDateTime
function expects.
The Person.EndDate.Value
is a TMS Aurelius nullable TDateTime
.
How is it possible that I get such date as result?
Normally Unix timestamps are in seconds since 1.1.1970. However, the value 1444288186967
is in milliseconds. Divide by 1000 and round and you will get the expected date and time 8.10.2015 7:09:47
i64 := round(1444288186967/1000);
dt := UnixToDateTime(i64);
Edit2.Text := DateTimeToStr(dt);
Edit2 shows 8.10.2015 7:09:47
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With