Unix2datetime issue?

Take the following timestamp: 1634587200000
Convert it with:
unix2datetime(1634587200000) 53768-01-03T08:00:00
If I go to: Unix Time Stamp - Epoch Converter, the result is Mon Oct 18 2021 20:00:00 GMT+0000

What am I missing?

From

?unix2datetime

you can see that the method expects seconds as an input. Your timestamp is in milliseconds.
Try

unix2datetime(1634587200)
4 Likes

If you’re doing more work with unix timestamps, I made a package for this, UnixTimes.jl. It uses a nanosecond representation and will let you preserve more accuracy than DateTime if you need it.

3 Likes

If you want others to use your package you’d be better off adding documentation :wink:

Sure, generally do. This is a single type and a tiny amount of self explanatory code, which I’ve not been advertising, just seemed relevant and potentially useful in the context of this topic.