Is there a way to convert a Unix Timestamp to a DateTime?

I’ve got a dataset that includes Unix Timestamps that I’d like to convert to a DateTime and/or a Date and a Time value. I don’t see a way to do it in EDT v1.33.0 but maybe I’m just missing it.

If there is not a way, I’d like to add it as a feature request since I have these in some of the datasets I am dealing with.

The value comes in as a integer representing the number of seconds since Jan 1, 1970 UTC. There are simple converters for it, e.g.:

We don’t currently directly support unix timestamp → date or vice versa. But you can do it using the Javascript transform. Pass the number milli seconds since 1-Jan-1970 to Javascript Date().

timestamp.transform (2.0 KB)

See the Easy Data Transform Javascript transform documentation for more details.

We might come up with an easier way to do this in future (e.g. using Calculate).

1 Like

Note that you can either use DateTime format to change the date time output from Javascript or you can use methods on the Javascript Date() object.

Thanks. I am by no means a Javascript expert, so i wouldn’t have thought of that.

It’s not ideal, but it should work for now.

Would be really good, keeping the milliseconds, too.

1 Like

I have found library functions to convert between milliseconds since epoch (1-Jan-1970) and ISO datetime, so it should hopefully be easy enough to add to Calculate in the next release. You would then just multiply by 1000 to get the Unix timestamp.

In the latest snapshot Calculate now has an option to convert from mSecs since 1970 to an ISO datetime, and vice versa.


Super! What I was doing prior to this was creating a file with dates and timestamps for each date, and doing a Lookup. This is much easier.

1 Like