Template talk:Dectime
(Redirected from Template talk:MJD2HMS)
- This the talk page for Template:Dectime and Template:MJD2HMS
Documentation
edit{{dectime}}
converts times given as hh mm ss (hours, minutes, seconds) to decimal fractions of a day.
Usage
edit{{dectime|hh|mm|ss}}
converts hh:mm:ss{{dectime|hh|mm|00}}
={{dectime|hh|mm}}
{{dectime|hh|00|00}}
={{dectime|hh}}
{{dectime}}
converts the current time incl. seconds
Examples
editThe following examples are usual times, but 00:00:00 up to 00:00:08 belong to the special cases shown below:
- {{
dectime|00|00|00
}} = 0 - {{
dectime|00|00|01
}} = 0.0000115740740741 - {{
dectime|00|00|08
}} = 0.0000925925925926 - {{
dectime|00|00|09
}} = 0.00010416666666667 - {{
dectime|00|22|30
}} = 0.015625 - {{
dectime|00|45|00
}} = 0.03125 - {{
dectime|01|30|00
}} = 0.0625 - {{
dectime|03|00|00
}} = 0.125 - {{
dectime|06|00|00
}} = 0.25 - {{
dectime|12|00|00
}} = 0.5 - {{
dectime|18|00|00
}} = 0.75 - {{
dectime|21|00|00
}} = 0.875 - {{
dectime|23|59|59
}} = 0.99998842592593 - {{
dectime|23|59|60
}} = 1 - {{
dectime|24|00|00
}} = 1 - {{
dectime|24.00000
}} = 1 {{dectime|09|50|05}}
= 0.40978009259259-
{{dectime}}
= 0.40978009259259 - Default time hh:00:00 if hours hh specified, otherwise the current time is extracted from
{{CURRENTTIMESTAMP}}
gives 20241015095005 [1] using{{Timestamp2MJD}}
to avoid critical races near hh:mm:59. The second to last example shown above might have this or another problem, it evaluates several "current" timestamps instead of one.
- For
{{dectime}}
results between 0 and 1 excluding 1{{MJD2HMS}}
can be used as inverse function. - {{
dectime|00|00|00
}} = 0, {{MJD2HMS|0|||=
}} gives 000000 - {{
dectime|00|00|01
}} = 0.0000115740740741 - {{
MJD2HMS|0.0000115740740741
}} = 00:00:01 - {{
dectime|23|59|59
}} = 0.99998842592593 - {{
MJD2HMS|0.999988425926
}} = 23:59:59 - {{
dectime|24|00|00
}} = 1, {{MJD2HMS|1|||=
}} gives 000000
Special cases
edit- The special cases are based on 86400 = 24*60*60
- Negative times are not supported:
- {{
dectime|00|-01|+59
}} = NegativeTimesNotSupported
- {{
- Null is a (trivial) special case, accuracy is milliseconds (rounded):
- {{
dectime|00|-01|+60
}} = 0 - {{
dectime|0|0|0.0004
}} = 0 - {{
dectime|0|0|0.0005
}} = 0.0000000115740740741
- {{
- Times before 00:00:00.009 (= 9 milliseconds) handled separately:
- {{
dectime|0|0|0.0010
}} = 0.0000000115740740741 - {{
dectime|0|0|0.0080
}} = 0.0000000925925925926 - {{
dectime|0|0|0.0084
}} = 0.0000000925925925926
- {{
- Times before 00:00:00.087 (= 87 milliseconds), 12 significant digits:
- {{
dectime|0|0|0.0085
}} = 0.000000104166666667 - {{
dectime|0|0|0.0860
}} = 0.000000995370370370 - {{
dectime|0|0|0.0864
}} = 0.000000995370370370
- {{
- Times before 00:00:00.864, all results are rounded:
- {{
dectime|0|0|0.0865
}} = 0.00000100694444444 - {{
dectime|0|0|0.8630
}} = 0.00000998842592593 - {{
dectime|0|0|0.8634
}} = 0.00000998842592593
- {{
- Times before 00:00:08.640 (= 8640 milliseconds):
- {{
dectime|0|0|0.8635
}} = 0.0000100000000000 - {{
dectime|0|0|8.6390
}} = 0.0000999884259259 - {{
dectime|0|0|8.6394
}} = 0.0000999884259259
- {{
- Normal handling starts at 00:00:08.640 (= 8640 milliseconds):
- {{
dectime|0|0|8.6395
}} = 0.0001 - {{
dectime|0|0|8.6400
}} = 0.0001 - {{
dectime|0|0|86.399
}} = 0.00099998842592593 - {{
dectime|0|0|86.400
}} = 0.001 - {{
dectime|00|01|26.4
}} = 0.001
- {{
- Huge timestamps are shown in exponential format:
- {{
dectime|23999999999987
}} = 999999999999.46 - {{
dectime|23999999999988
}} = 999999999999.5 - {{
dectime|24000000000000
}} = 1000000000000 - {{
dectime|36000000000000
}} = 1500000000000
- {{
Note that trailing zeros are not truncated for times between 0 and 8640 milliseconds. Adding 0 or a similar operation would result in exponential format for input values below 8640 milliseconds.
The special handling is important for {{MJD}}
={{YMD2MJD}}
+{{dectime}}
, some parser functions don't support input in exponential format.
Optional substitution works if all three parameters and subst=subst: are specified, or for the current time {{subst:dectime|subst=subst:}}.
See also
editDiscussion
edit- Add issues below as you see fit, sign with ~~~~