Difference between revisions of "Template:Current hour offset in time zone/doc"

From blackwiki
Jump to navigation Jump to search
imported>Anthony Appleyard
m (Anthony Appleyard moved page Template:Current hour offset in time zone/old/doc to Template:Current hour offset in time zone/doc without leaving a redirect: histmerge)
imported>Anthony Appleyard
(rv histmerge junk)
Line 1: Line 1:
{{#if:{{{1|}}}||{{Documentation subpage}}
+
This template calculates the current hour offset in a time zone.
This template gives the current hour offset from [[UTC]] time for the given [[time zone]].
+
==Parameters==
 
+
This template takes one unnamed parameter, the time zone abbreviation.
If the <code>dst</code> parameter is not used, it uses {{tl|Daylight saving in time zone}} to automatically adjust the offset according to [[daylight saving time]] (DST), if applicable.
 
 
 
This template can be used in conjunction with {{tl|Current minute offset in time zone/old}} to calculate the current time in a particular time zone. See below for the currently supported time zones.
 
 
 
==Usage==
 
{{Pre|{{((}}Current hour offset in time zone/old{{!}}''time zone''<span style{{=}}"color:#777">[</span>{{!}}dst{{=}}''no''<span style{{=}}"color:#777">]</span>{{))}}}}
 
:(<code><span style{{=}}"color:#777">[</span>...<span style{{=}}"color:#777">]</span></code> means ''optional'', do not include the square brackets when using this template)
 
where
 
*''time zone'' is the desired time zone abbreviation (see below and also the [[list of time zone abbreviations]]);<br />If no time zone is given or if the given time zone is not supported, then the output will default to 0;<br />In this case, instead of giving a time zone, an '''offset''' (e.g. -3, 1, 5, etc.) can also be given;<br />This exact offset will then be used as the output (this functionality is merely included for template compatibility);
 
*<code>dst</code> is an optional parameter to disable automatic daylight saving time adjustment by setting the value to "no";<br />If a DST variant of a particular time zone exists, then the time is automatically adjusted according to DST by default.
 
 
 
==Supported time zones==
 
Currently the following time zones are supported:}}
 
{| class="wikitable"
 
|-
 
! colspan="2" | {{nowrap|[[File:Snow flake icon.png|24px|alt=SDT&nbsp;-|link=Standard time|Standard time abbreviation]]&nbsp;Abbreviations&nbsp;[[File:Crystal sun.png|24px|alt=-&nbsp;DST|link=Daylight saving time|Daylight saving time abbreviation]]}}
 
! Name
 
! colspan="2" | {{nowrap|[[File:Snow flake icon.png|24px|alt=SDT&nbsp;-|link=Standard time|Standard time offset]]&nbsp;{{Purge|Offset}}&nbsp;[[File:Crystal sun.png|24px|alt=-&nbsp;DST|link=Daylight saving time|Daylight saving time offset]]}}
 
! Notes
 
|-
 
| '''HST'''
 
|
 
| Hawaii Standard Time
 
| colspan="2" style="text-align:center" | UTC'''−10''':00
 
| rowspan="10" | When <code>dst</code> is NOT set to "no", the *T, *ST and *DT variants of a particular time zone will produce the same output and can be used interchangeably.
 
Otherwise (when using <code>dst=no</code>), *T and *ST will produce the offset without DST adjustment, and *DT will produce the offset with DST adjustment.
 
 
 
DST is not observed in [[Hawaii]] and in [[Time in Saskatchewan|Saskatchewan, Canada]] (except [[Lloydminster|Lloydminster, SK]], where MST/MDT is observed).
 
|-
 
| '''HAT''' or '''HAST'''
 
| '''HADT'''
 
| Hawaii-Aleutian Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|HAT}}||style="background-color:#89CFF0"{{!}}}} UTC'''−10''':00
 
| {{#ifexpr:{{Daylight saving in time zone|HAT}}|style="background-color:#89CFF0"{{!}}}} UTC'''−09''':00
 
|-
 
| '''AKT''' or '''AKST'''
 
| '''AKDT'''
 
| Alaska Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|AKT}}||style="background-color:#89CFF0"{{!}}}} UTC'''−09''':00
 
| {{#ifexpr:{{Daylight saving in time zone|AKT}}|style="background-color:#89CFF0"{{!}}}} UTC'''−08''':00
 
|-
 
| '''PT''' or '''PST'''
 
| '''PDT'''
 
| Pacific Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|PT}}||style="background-color:#89CFF0"{{!}}}} UTC'''−08''':00
 
| {{#ifexpr:{{Daylight saving in time zone|PT}}|style="background-color:#89CFF0"{{!}}}} UTC'''−07''':00
 
|-
 
| '''MT''' or '''MST'''
 
| '''MDT'''
 
| Mountain Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|MT}}||style="background-color:#89CFF0"{{!}}}} UTC'''−07''':00
 
| {{#ifexpr:{{Daylight saving in time zone|MT}}|style="background-color:#89CFF0"{{!}}}} UTC'''−06''':00
 
|-
 
| '''SKT''' or '''SKST'''
 
|
 
| Saskatchewan Standard Time
 
| colspan="2" style="text-align:center" | UTC'''−06''':00
 
|-
 
| '''CT''' or '''CST'''
 
| '''CDT'''
 
| Central Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|CT}}||style="background-color:#89CFF0"{{!}}}} UTC'''−06''':00
 
| {{#ifexpr:{{Daylight saving in time zone|CT}}|style="background-color:#89CFF0"{{!}}}} UTC'''−05''':00
 
|-
 
| '''ET''' or '''EST'''
 
| '''EDT'''
 
| Eastern Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|ET}}||style="background-color:#89CFF0"{{!}}}} UTC'''−05''':00
 
| {{#ifexpr:{{Daylight saving in time zone|ET}}|style="background-color:#89CFF0"{{!}}}} UTC'''−04''':00
 
|-
 
| '''AT''' or '''AST'''
 
| '''ADT'''
 
| Atlantic Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|AT}}||style="background-color:#89CFF0"{{!}}}} UTC'''−04''':00
 
| {{#ifexpr:{{Daylight saving in time zone|AT}}|style="background-color:#89CFF0"{{!}}}} UTC'''−03''':00
 
|-
 
| '''NT''' or '''NST'''
 
| '''NDT'''
 
| Newfoundland Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|NT}}||style="background-color:#89CFF0"{{!}}}} UTC'''−03''':30
 
| {{#ifexpr:{{Daylight saving in time zone|NT}}|style="background-color:#89CFF0"{{!}}}} UTC'''−02''':30
 
|-
 
| style="background-color:#F2F2F2" | '''GMT'''
 
| style="background-color:#F2F2F2" | '''BST'''
 
| style="background-color:#F2F2F2" | Greenwich Mean Time /<br />British Summer Time
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|GMT}}|F2F2F2|89CFF0}}" | UTC'''+00''':00
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|GMT}}|89CFF0|F2F2F2}}" | UTC'''+01''':00
 
| style="background-color:#F2F2F2" | When <code>dst</code> is NOT set to "no", both the GMT and BST variants of this time zone will produce the same output and can be used interchangeably.
 
Otherwise (when using <code>dst=no</code>), GMT will produce the offset without DST adjustment, and BST will produce the offset with DST adjustment.
 
|-
 
| style="background-color:#F2F2F2" | '''WET'''
 
| style="background-color:#F2F2F2" | '''WEST'''
 
| style="background-color:#F2F2F2" | Western European (Summer) Time
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|WET}}|F2F2F2|89CFF0}}" | UTC'''+00''':00
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|WET}}|89CFF0|F2F2F2}}" | UTC'''+01''':00
 
| style="background-color:#F2F2F2" rowspan="3" | When <code>dst</code> is NOT set to "no", both the *ET and *EST variants of a particular time zone will produce the same output and can be used interchangeably.
 
Otherwise (when using <code>dst=no</code>), *ET will produce the offset without DST adjustment, and *EST will produce the offset with DST adjustment.
 
|-
 
| style="background-color:#F2F2F2" | '''CET'''
 
| style="background-color:#F2F2F2" | '''CEST'''
 
| style="background-color:#F2F2F2" | Central European (Summer) Time
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|CET}}|F2F2F2|89CFF0}}" | UTC'''+01''':00
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|CET}}|89CFF0|F2F2F2}}" | UTC'''+02''':00
 
|-
 
| style="background-color:#F2F2F2" | '''EET'''
 
| style="background-color:#F2F2F2" | '''EEST'''
 
| style="background-color:#F2F2F2" | Eastern European (Summer) Time
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|EET}}|F2F2F2|89CFF0}}" | UTC'''+02''':00
 
| style="background-color:#{{#ifexpr:{{Daylight saving in time zone|EET}}|89CFF0|F2F2F2}}" | UTC'''+03''':00
 
|-
 
| '''AWT''' or '''AWST'''
 
|
 
| Australian Western Standard Time
 
| colspan="2" style="text-align:center" | UTC'''+08''':00
 
| rowspan="3" | When <code>dst</code> is NOT set to "no", the *T, *ST and *DT variants of a particular time zone will produce the same output and can be used interchangeably.
 
Otherwise (when using <code>dst=no</code>), *T and *ST will produce the offset without DST adjustment, and *DT will produce the offset with DST adjustment.
 
 
 
DST is not observed in the AWT time zone.
 
|-
 
| '''ACT''' or '''ACST'''
 
| '''ACDT'''
 
| Australian Central Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|ACT}}||style="background-color:#89CFF0"{{!}}}} UTC'''+09''':30
 
| {{#ifexpr:{{Daylight saving in time zone|ACT}}|style="background-color:#89CFF0"{{!}}}} UTC'''+10''':30
 
|-
 
| '''AET''' or '''AEST'''
 
| '''AEDT'''
 
| Australian Eastern Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|AET}}||style="background-color:#89CFF0"{{!}}}} UTC'''+10''':00
 
| {{#ifexpr:{{Daylight saving in time zone|AET}}|style="background-color:#89CFF0"{{!}}}} UTC'''+11''':00
 
|-
 
| style="background-color:#F2F2F2" | '''KST'''
 
| style="background-color:#F2F2F2" |
 
| style="background-color:#F2F2F2" | Korea Standard Time
 
| colspan="2" style="background-color:#F2F2F2;text-align:center;" | UTC'''+09''':00
 
| style="background-color:#F2F2F2" rowspan="2" | DST is not observed in these time zones. It is not necessary to set <code>dst</code>.
 
|-
 
| style="background-color:#F2F2F2" | '''JST'''
 
| style="background-color:#F2F2F2" |
 
| style="background-color:#F2F2F2" | Japan Standard Time
 
| colspan="2" style="background-color:#F2F2F2;text-align:center;" | UTC'''+09''':00
 
|-
 
| '''NZT''' or '''NZST'''
 
| '''NZDT'''
 
| New Zealand Standard/Daylight Time
 
| {{#ifexpr:{{Daylight saving in time zone|NZT}}||style="background-color:#89CFF0"{{!}}}} UTC'''+12''':00
 
| {{#ifexpr:{{Daylight saving in time zone|NZT}}|style="background-color:#89CFF0"{{!}}}} UTC'''+13''':00
 
| When <code>dst</code> is NOT set to "no", the NZT, NZST and NZDT variants of this time zone will produce the same output and can be used interchangeably.
 
Otherwise (when using <code>dst=no</code>), NZT and NZST will produce the offset without DST adjustment, and NZDT will produce the offset with DST adjustment.
 
|}
 
{{#if:{{{1|}}}||
 
==Time zone map==
 
[[File:Worldwide Time Zones (including DST).png|center|800px]]
 
 
 
 
==Examples==
 
==Examples==
<small>(You may want to {{Purge|purge}} this page to update the output.)</small>
+
*{{Current_hour_offset_in_time_zone|EST}}
 
+
:*<code><nowiki>{{Current_hour_offset_in_time_zone|EST}}</nowiki></code>
 
+
----
<pre>*{{Current hour offset in time zone/old|CET}}</pre>
+
*{{Current_hour_offset_in_time_zone|IST}}
produces
+
:*<code><nowiki>{{Current_hour_offset_in_time_zone|IST}}</nowiki></code>
*{{Current hour offset in time zone/old|CET}}
+
----
 
+
*{{Current_hour_offset_in_time_zone|WET}}
 
+
:*<code><nowiki>{{Current_hour_offset_in_time_zone|WET}}</nowiki></code>
<pre>*{{Current hour offset in time zone/old|CET|dst=no}}</pre>
+
----
produces
+
*{{Current_hour_offset_in_time_zone|NZST}}
*{{Current hour offset in time zone/old|CET|dst=no}}
+
:*<code><nowiki>{{Current_hour_offset_in_time_zone|NZST}}</nowiki></code>
 
+
----
 
+
*{{Current hour offset in time zone|UTC+07:00}}
<pre>*{{Current hour offset in time zone/old|CEST}}</pre>
+
:*<code><nowiki>{{Current_hour_offset_in_time_zone|UTC+07:00}}</nowiki></code>
produces
+
{{Time related templates}}
*{{Current hour offset in time zone/old|CEST}}
 
 
 
 
 
<pre>*{{Current hour offset in time zone/old|CEST|dst=no}}</pre>
 
produces
 
*{{Current hour offset in time zone/old|CEST|dst=no}}
 
 
 
 
 
<pre>*{{Current hour offset in time zone/old|PT}}</pre>
 
produces
 
*{{Current hour offset in time zone/old|PT}}
 
 
 
 
 
<pre>*{{Current hour offset in time zone/old|-4}}</pre>
 
produces
 
*{{Current hour offset in time zone/old|-4}}
 
 
 
 
 
<pre>*{{Current hour offset in time zone/old}}</pre>
 
produces
 
*{{Current hour offset in time zone/old}}
 
 
 
==Related templates==
 
*{{tl|Current minute offset in time zone/old}}
 
*{{tl|Current hour in time zone}}
 
*{{tl|Current minute in time zone}}
 
*{{tl|Daylight saving in time zone}}
 
}}
 

Revision as of 04:34, 21 August 2018

This template calculates the current hour offset in a time zone.

Parameters

This template takes one unnamed parameter, the time zone abbreviation.

Examples

  • -4
  • {{Current_hour_offset_in_time_zone|EST}}

  • 0
  • {{Current_hour_offset_in_time_zone|IST}}

  • 1
  • {{Current_hour_offset_in_time_zone|WET}}

  • 12
  • {{Current_hour_offset_in_time_zone|NZST}}

  • 0
  • {{Current_hour_offset_in_time_zone|UTC+07:00}}

Template:Time related templates