# Template:Timestamp2MJD

Note: this template **does not work** on installations (as has been observed on Windows) where a number, before mod is applied, is reduced to php data-type "signed INT", i.e. a signed 32-bits integer [1], i.e. where mod gives wrong results for integers outside the range -2,147,483,648 through 2,147,483,647. This template applies mod to timestamps, which have 14 digits, five too many. It could be rewritten either to use Template:Mod (which uses "round"), or use "round" directly. Also replacing mod with fmod seems to work, if mw:Extension:ParserFunctions (extended) has been installed.

- This auxiliary template allows template:MJD (edit•talk•links•history) to operate on a
**single**`"{{CURRENTTIMESTAMP|=}}"`

gives "Template:CURRENTTIMESTAMP" [2] without risk of critical races: - 60592.156863426

Usage: `{{Timestamp2MJD|YYYYMMDDhhmmss}}`

, only non-negative whole numbers, almost no error
handling. Months are checked for plausibility, this catches incomplete timestamps *hhmmss* and
some variations of *YYYYMMDD hmmss* instead of

*YYYYMMDD*.

**0h**mmss- {{
`Timestamp2MJD`

}} gives**|**0**Expression error: Unrecognized word "badmonth".** - {{
`Timestamp2MJD`

}} gives -678940.05990741, NOT RECOMMENDED**|**101223344**|****|****|**= - {{
`Timestamp2MJD`

}} gives -678941, minimal Gregorian date**|**00000101000000**|****|****|**= - {{
`Timestamp2MJD`

}} gives -605833, see also**|**02000301000000**|****|****|**=`{{YMD2MJD}}`

- {{
`Timestamp2MJD`

}} gives -1.0599074074074**|**18581115223344**|****|****|**= - {{
`Timestamp2MJD`

}} gives -0.05990740740741**|**18581116223344**|****|****|**= - {{
`Timestamp2MJD`

}} gives 0.94009259259259**|**18581117223344**|****|****|**= - {{
`Timestamp2MJD`

}} gives 1.9400925925926**|**18581118223344**|****|****|**= - {{
`Timestamp2MJD`

}} gives -2**|**(18581115223344 round -6)**|****|****|**= - {{
`Timestamp2MJD`

}} gives -1**|**(18581116223344 round -6)**|****|****|**= - {{
`Timestamp2MJD`

}} gives 0**|**(18581117223344 round -6)**|****|****|**= - {{
`Timestamp2MJD`

}} gives 1**|**(18581118223344 round -6)**|****|****|**= - {{
`Timestamp2MJD`

}} gives 60592**|**(20241009034553 round -6)**|****|****|**=

Test with subst and 20070321123457 (see edit box):

- 54180