Jump to content

Template:MJD2HMS

From Meta, a Wikimedia project coordination wiki

05:30:42


The shown test value should be near hh:mm:ss in 20241225053042. This self test can fail in the second hh:mm:59, real applications use a unique timestamp which won't change while it's evaluated.

This template is the opposite of template:Dectime (edittalklinkshistory) to a certain degree, it converts decimal fractions to hh:mm:ss. Days before the decimal point are accepted and ignored within reasonable limits (see below). The formula is based on 24*60*60=86400 with 24 hours, don't use it for degrees.

Usage
{{MJD2HMS|dectime|separator}}
{{MJD2HMS|dectime}}, the default separator is a colon.
Examples
{{MJD2HMS|+.1|}} = 022400
{{MJD2HMS|0.0|}} = 000000
{{MJD2HMS|-.1|}} = 213600
{{MJD2HMS|+.87654}} = 21:02:13
{{MJD2HMS|-.87654}} = 02:57:47
{{Timestamp2MJD|18581117210213}} = 0.87653935185185
{{MJD}} = 0.87653935185185
{{Timestamp2MJD|18581116025747}} = -0.87653935185185
{{MJD}} = -0.87653935185185
{{MJD2HMS|-32109.87654}} = 02:57:47
{{Timestamp2MJD|17701218025747}} = -32109.876539352
{{MJD}} = -32109.876539352
Accuracy restrictions (also for MOD )
{{MJD2HMS| -9999999.87654}} = 02:57:47
{{MJD2HMS|-10000000.87654}} = Parameter out of range
{{MJD}} = -9999997.8765394
{{MJD}} = -9999998.8765394
{{MJD2HMS|+ 9999999.87654}} = 21:02:13
{{MJD2HMS|+10000000.87654}} = Parameter out of range
{{MJD}} = 9999999.8765394
{{Timestamp2MJD|292371211210213}} = 9999999.8765394
{{MJD}} = 10000000.876539
{{Timestamp2MJD|292371212210213}} = 10000000.876539
For optional substitution both parameters have to be specified
{{subst:MJD2HMS|dectime|separator|subst=subst:}}