Choose Language Hide Translation Bar
Highlighted
jfsilves
Level I

Converting Seconds since the epoch to datetime

I have a column of data representing datetime stamps that is stored in seconds since the epoch (1 Jan 1970). 

 

How can I make JMP interpret these integers as datetime stamps?

2 REPLIES 2
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: Converting Seconds since the epoch to datetime

You'll need to add 01Jan1970 to each of those.

 

You can use  01Jan1970 as an unquoted constant to do that.

 

For example:

 

today70=1583246337; //03Mar2020 in seconds since 01Jan1970;

today_jmp=today70 + 01Jan1970; //add number of seconds from 01Jan1904

format(today_jmp, "mm/dd/yyyy");

Results:

 

/*:

"03/03/2020"

Note: you can use any date, not just 01Jan1970, as a constant like that.

-Jeff
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: Converting Seconds since the epoch to datetime

Also, you'll find more information about this topic in Using dates, times, datetimes and durations in JMP

-Jeff
Article Labels

    There are no labels assigned to this post.