- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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