- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How do use JSL to convert seconds since January 1, 1970 to HH:MM:SS days, months and years?
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How do use JSL to convert seconds since January 1, 1970 to HH:MM:SS days, months and years?
The formula to make the modification is:
1652335737 + Informat( "01/01/1970", "mm/dd/yyyy" ) + In Hours( 8 )
The addition of the 8 hours in the calculation, is that apparently the start time for the 01/01/1970 is 08:00:00
This JSL displays the new calculated value from the formula
Show( Format( 1652335737 + Informat( "01/01/1970", "mm/dd/yyyy" ) + In Hours( 8 ), "yyyy-mm-ddThh:mm:ss" ) );
Format(1652335737 + Informat("01/01/1970", "mm/dd/yyyy") + In Hours(8), "yyyy-mm-ddThh:mm:ss") = "2022-05-12T14:08:57";
Jim
5 REPLIES 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How do use JSL to convert seconds since January 1, 1970 to HH:MM:SS days, months and years?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How do use JSL to convert seconds since January 1, 1970 to HH:MM:SS days, months and years?
OK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How do use JSL to convert seconds since January 1, 1970 to HH:MM:SS days, months and years?
The formula to make the modification is:
1652335737 + Informat( "01/01/1970", "mm/dd/yyyy" ) + In Hours( 8 )
The addition of the 8 hours in the calculation, is that apparently the start time for the 01/01/1970 is 08:00:00
This JSL displays the new calculated value from the formula
Show( Format( 1652335737 + Informat( "01/01/1970", "mm/dd/yyyy" ) + In Hours( 8 ), "yyyy-mm-ddThh:mm:ss" ) );
Format(1652335737 + Informat("01/01/1970", "mm/dd/yyyy") + In Hours(8), "yyyy-mm-ddThh:mm:ss") = "2022-05-12T14:08:57";
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How do use JSL to convert seconds since January 1, 1970 to HH:MM:SS days, months and years?
How do reverse this calculation?
For example, calculate the date 20230214 into seconds
Thanks!
In Days( Informat( Char( 20230214 ) ) -In Hours( 8 ) ) - In Days( 1jan1970 )
??
1676304000000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How do use JSL to convert seconds since January 1, 1970 to HH:MM:SS days, months and years?
Names Default To Here( 1 );
date = "20230214";
// The JMP time values are based upon the number of seconds
// since January 1, 1904, therefore the calculation to the
// number of seconds since then would be
JMPDate = Date MDY( num(substr(date,5,2)), num(substr(date,7,2)), num(substr(date, 1, 4)));
show(JMPDate, format(JMPDate,"m/d/y"));
// To convert this to the number of seconds since January 1, 1970
Jan1970Date = JMPDate - informat("01/01/1970", "m/d/y");
show(Jan1970Date);
Jim