Template:MJD2HMS

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search

03:58:09


The shown test value should be near hh:mm:ss in 20091225035809. 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|1858|11|17|21|02|13}} = 0.87653935185185
{{ Timestamp2MJD|18581116025747}} = -0.87653935185185
{{MJD|1858|11|16|02|57|47}} = -0.87653935185185
{{ MJD2HMS|-32109.87654}} = 02:57:47
{{ Timestamp2MJD|17701218025747}} = -32109.876539352
{{MJD|1770|12|18|02|57|47}} = -32109.876539352
Accuracy restrictions (also for MOD ):
{{ MJD2HMS| -9999999.87654}} = 02:57:47
{{ MJD2HMS|-10000000.87654}} = Parameter out of range
{{MJD|-25520|05|03|02|57|47}} = -9999999.8765394
{{MJD|-25520|05|02|02|57|47}} = -10000000.876539
{{ MJD2HMS|+ 9999999.87654}} = 21:02:13
{{ MJD2HMS|+10000000.87654}} = Parameter out of range
{{MJD|29237|12|11|21|02|13}} = 9999999.8765394
{{ Timestamp2MJD|292371211210213}} = 9999999.8765394
{{MJD| 29237|12|12|21|02|13}} = 10000000.876539
{{ Timestamp2MJD|292371212210213}} = 10000000.876539
For optional substitution both parameters have to be specified:
{{ subst:MJD2HMS|dectime|separator|subst=subst: }}