Difference between revisions of "Template:ExpandTime"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (-new line; +define what minute/hour/day mean;)
(*use 6h days;)
Line 1: Line 1:
<includeonly>{{#ifexpr: {{{1}}} >= 86400|{{formatnum|{{#expr: trunc({{{1}}} / 86400)}}}}&nbsp;{{lang|en=d|ru=дней}}|}} {{#ifexpr: {{{1}}} >= 3600|{{#expr: {{{1}}} / 3600 mod 24}}&nbsp;{{lang|en=h|pl=g|ru=часов}}|}} {{#ifexpr: {{{1}}} >= 60|{{#expr: {{{1}}} / 60 mod 60}}&nbsp;{{lang|en=m|ru=минут}}|}} {{#expr: {{{1}}} mod 60 + {{{1}}} - trunc({{{1}}}) round 1}}&nbsp;{{lang|en=s|ru=секунд}}</includeonly><noinclude>{| class="wikitable"
+
<includeonly>{{#ifexpr: {{{1}}} >= 21600|{{formatnum|{{#expr: trunc({{{1}}} / 21600)}}}}&nbsp;{{lang|en=<abbr title="Kerbin days (= 6 h)">d</abbr>|de=<abbr title="Kerbin Tage (= 6 Std.)>d</abbr>}}|}} {{#ifexpr: {{{1}}} >= 3600|{{#expr: {{{1}}} / 3600 mod 24}}&nbsp;{{lang|en=h|pl=g|ru=часов}}|}} {{#ifexpr: {{{1}}} >= 60|{{#expr: {{{1}}} / 60 mod 60}}&nbsp;{{lang|en=m|ru=минут}}|}} {{#expr: {{{1}}} mod 60 + {{{1}}} - trunc({{{1}}}) round 1}}&nbsp;{{lang|en=s|ru=секунд}}</includeonly><noinclude>{| class="wikitable"
 
! #
 
! #
 
! Description
 
! Description
Line 10: Line 10:
 
* 1 minute = 60 seconds
 
* 1 minute = 60 seconds
 
* 1 hour = 60 minutes = 3600 seconds
 
* 1 hour = 60 minutes = 3600 seconds
* 1 day = 24 hours = 1440 minutes = 86400 seconds
+
* 1 day = 24 hours = 360 minutes = 21600 seconds
 +
 
 +
It uses Kerbin's sidereal days as this is the time unit shown on the UI.
  
 
== Example ==
 
== Example ==

Revision as of 16:48, 28 January 2015

# Description
1 Time in seconds

This template converts a time given in seconds into multiple different time units (days, hours, minutes and seconds), where:

  • 1 minute = 60 seconds
  • 1 hour = 60 minutes = 3600 seconds
  • 1 day = 24 hours = 360 minutes = 21600 seconds

It uses Kerbin's sidereal days as this is the time unit shown on the UI.

Example

{{ExpandTime|9203544.6}}

426 d 0 h 32 m 24.6 s