Difference between revisions of "Template:12-hour time/doc"

From blackwiki
Jump to navigation Jump to search
blackwiki>Jimp
m (Jimp moved page Template:12-hour time/dowoff/dmy to Template:12-hour time/doc without leaving a redirect)
blackwiki>Jimp
Line 1: Line 1:
<includeonly>{{{g}}}:{{{i}}}{{#if:{{{s|}}}|<nowiki>:</nowiki>{{{s}}}}}&nbsp;{{#ifexpr:{{{g}}}=12 and ({{{s|}}}+{{{i}}})=0
+
This template displays the current time & date in 12-hour format.
  |{{#ifeq:{{{a|am}}}|am
+
*The default time zone is UTC.  This can be changed by setting an offset.  For an interger number of hours use parameter 1.  Otherwise use <code>offset</code>
    |midnight {{{x}}} {{nowrap|{{#time: d {{#ifeq:{{{z}}}|on|M|F}}|{{#expr:{{{d}}}-1}} {{{m}}} {{{y}}}}}}}<!--
+
**The current UTC time is {{12-hour time}} (use {{<code>12-hour time</code>}})
                    -->{{#switch:{{{d}}} {{{m}}}|1 January|1 Jan=&nbsp;{{#expr:{{{y}}}-1}}}}/
+
**The current time in city Saskatoon is {{12-hour time|-7}} (use {{<code>12-hour time|-7</code>}})
    |noon {{{x}}}&#32;
+
**The current time in Darwin is {{12-hour time|offset=9 hours 30 min}} (use {{<code>12-hour time|offset=9 hours 30 min</code>}} not {{<code>12-hour time|9.5</code>}})
  }}
+
*The default date format is day month year.  For month day year use {{<code>12-hour time|format=mdy</code>}}, for example
  |{{{a}}} {{{x}}}&#32;
+
**{{12-hour time|format=mdy}}
}}{{{d}}}&nbsp;{{{m}}} {{{y}}}</includeonly><noinclude>{{12-hour time}}</noinclude>
+
*The default is not to show seconds or the day of the week.  To display these use {{<code>12-hour time|sec=on</code>}} and/or {{<code>12-hour time|dow=on</code>}} respectively, for example
 +
**{{12-hour time|sec=on}}
 +
**{{12-hour time|dow=on}}
 +
**{{12-hour time|sec=on|dow=on}}
 +
*The default is not to abbreviate the names of the day or month.  To abbreviate use {{<code>12-hour time|abbr=on</code>}}, for example
 +
**{{12-hour time|abbr=on}}
 +
**{{12-hour time|abbr=on|dow=on}}
 +
*The default is to put "on" between the time and date.  To use something else use {{<code>12-hour time|=</code>''something else''}}, for example,
 +
**{{12-hour time|text=(UTC) on}}

Revision as of 09:35, 23 May 2012

This template displays the current time & date in 12-hour format.

  • The default time zone is UTC. This can be changed by setting an offset. For an interger number of hours use parameter 1. Otherwise use offset
    • The current UTC time is 5:34 pm on 20 December 2025 (use {{12-hour time}})
    • The current time in city Saskatoon is 10:34 am on 20 December 2025 (use {{12-hour time|-7}})
    • The current time in Darwin is 3:04 am on 21 December 2025 (use {{12-hour time|offset=9 hours 30 min}} not {{12-hour time|9.5}})
  • The default date format is day month year. For month day year use {{12-hour time|format=mdy}}, for example
    • 5:34 pm on December 20, 2025
  • The default is not to show seconds or the day of the week. To display these use {{12-hour time|sec=on}} and/or {{12-hour time|dow=on}} respectively, for example
    • 5:34:32 pm on 20 December 2025
    • 5:34 pm on Saturday 20 December 2025
    • 5:34:32 pm on Saturday 20 December 2025
  • The default is not to abbreviate the names of the day or month. To abbreviate use {{12-hour time|abbr=on}}, for example
    • 5:34 pm on 20 Dec 2025
    • 5:34 pm on Sat 20 Dec 2025
  • The default is to put "on" between the time and date. To use something else use {{12-hour time|=something else}}, for example,
    • 5:34 pm (UTC) on 20 December 2025