Template talk:MJD2sec

Talk page for {{MJD2sec}} and {{sec2MJD}}

Documentation

edit

Posix timestamps count seconds since 1970-01-01T00:00Z, negative values indicate timestamps before this date.

Usage

edit
  • {{MJD2sec|mjd}} converts a Modified Julian Date to a Posix timestamp.
  • {{MJD2sec}} gives the current Posix timestamp.
  • {{sec2MJD|sec}} converts a Posix timestamp to a Modified Julian Date.
  • {{sec2MJD}} is a sanity test, it should be the same as {{MJD}}.

Examples

edit
Critical POSIX timestamps (31/32 bits rollover)
Timestamp MJD MJD2sec sec2MJD comment
1901-12-13 20:45:52 15731.865185185 -2147483648 15731.865185185 -2^31
2038-01-19 03:14:07 65442.134803241 2147483647 65442.134803241  2^31-1
2038-01-19 03:14:08 65442.134814815 2147483648 65442.134814815  2^31
2106-02-07 06:28:15 90297.269618056 4294967295 90297.269618056  2^32-1
2106-02-07 06:28:16 90297.26962963 4294967296 90297.26962963  2^32
Optional substitution works for a specified parameter, examples:
{{ subst:sec2MJD2|1677283200|subst=subst:}} = 60000,
{{ subst:MJD2sec|60000|subst=subst:}} = 1677283200,
{{ subst:MJD2sec|{{ subst:MJD|subst=subst:}}|subst=subst:}}.

The third example is convoluted, but supporting optional substitution for a parameter default would make the MJD2sec code unnecessarily complex, and for sec2MJD it would be pointless.

See also

edit

Discussion

edit
Add issues below as you see fit, sign with ~~~~
Return to "MJD2sec" page.