Difference between revisions of "Template:Deg2HMS"

From blackwiki
Jump to navigation Jump to search
imported>Tom.Reding
(Incorporate "round 14", similar to Template:Deg2DMS, to eliminate "60 seconds" output & round to the next minute)
imported>Tom.Reding
m (Make easier to read)
 
Line 1: Line 1:
{{#expr: FLOOR({{{1|0}}}/15)}}{{#if:{{{sup|}}}|<sup>h</sup>&nbsp;|&#58;}}{{#expr: FLOOR( ((({{{1|0}}}/15) - FLOOR({{{1|0}}}/15)) round 14 )*60)}}{{#if:{{{sup|}}}|<sup>m</sup>&nbsp;|&#58;}}{{#expr: (((({{{1|0}}}/15)-FLOOR({{{1|0}}}/15))*60) - FLOOR( ((({{{1|0}}}/15)-FLOOR({{{1|0}}}/15)) round 14 )*60))*60 round {{#if:{{{p|}}}|{{{p|}}}|3}}}}{{#if:{{{sup|}}}|<sup>s</sup>}}<noinclude>
+
<!--
 +
-->{{#expr: FLOOR({{{1|0}}}/15)}}{{#if:{{{sup|}}}|<sup>h</sup>&nbsp;|&#58;}}<!--
 +
-->{{#expr: FLOOR( ((({{{1|0}}}/15) - FLOOR({{{1|0}}}/15)) round 14 )*60)}}{{#if:{{{sup|}}}|<sup>m</sup>&nbsp;|&#58;}}<!--
 +
-->{{#expr: (((({{{1|0}}}/15)-FLOOR({{{1|0}}}/15))*60) - FLOOR( ((({{{1|0}}}/15)-FLOOR({{{1|0}}}/15)) round 14 )*60))*60 round {{#if:{{{p|}}}|{{{p|}}}|3}}}}{{#if:{{{sup|}}}|<sup>s</sup>}}<noinclude>
 
{{documentation}}
 
{{documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 13:50, 26 April 2016

0:0:0

Template documentation[view] [edit] [history] [purge]

Description

This template converts a decimal degree value, typically right ascension, to hours:minutes:seconds format or to hoursh minutesm secondss format.

Usage

{{Deg2HMS|decimaldegrees|p=precision|sup=superscripts}}.

Parameter p is optional and defaults to 3.
Parameter sup is optional and defaults to not-used, <blank>, or <null>. It is activated by "yes", or any text.

For example:
{{Deg2HMS|266.416837|p=4}} returns 17:45:40.0409.
{{Deg2HMS|266.416837|p=4|sup= }} returns 17:45:40.0409.

{{Deg2HMS|266.416837|p=4|sup=yes}} returns 17h 45m 40.0409s.
{{Deg2HMS|266.416837|p=4|sup=y}} returns 17h 45m 40.0409s.
{{Deg2HMS|266.416837|p=4|sup=no}} returns 17h 45m 40.0409s.

See also