cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
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?

1 ACCEPTED SOLUTION

Accepted Solutions
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

View solution in original post

2 REPLIES 2
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
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