Difference between revisions of "Template:CurrentTimeIn"

From blackwiki
Jump to navigation Jump to search
imported>Verdy p
m
imported>Verdy p
m
Line 1: Line 1:
[[List of time zones|{{utc|{{sum|{{{UsualDifferenceFromUTCForThisLocation}}}|{{{DSTAdjustment}}}}}}}]]<noinclude>
+
<includeonly>[[List of time zones|{{utc|{{#expr:({{{UsualDifferenceFromUTCForThisLocation|0}}})+({{{DSTAdjustment|0}}})}}}}]]</includeonly><noinclude>{{Template documentation}}
----
 
{{Template documentation}}
 
  
==Usage instructions==
+
This template prints the current UTC time offset by (UsualDifferenceFromUTCForThisLocation + DSTAdjustment) hours.
This template prints the current UTC time offset by ($UsualDifferenceFromUTCForThisLocation + $DSTAdjustment) hours where the terms beginning with $ are named arguments to the template.
 
  
==Rationale==
+
; Syntax<nowiki>:</nowiki>
 +
: <tt><nowiki>{{</nowiki>{{PAGENAME}} ''<nowiki>[</nowiki>'' <nowiki>|</nowiki></tt>
 +
:: <tt>''<nowiki>[</nowiki>'' UsualDifferenceFromUTCForThisLocation=''hours''<nowiki>|</nowiki> ''<nowiki>]</nowiki>''</tt>
 +
:: <tt>''<nowiki>[</nowiki>'' DSTAdjustment=''hours''<nowiki>|</nowiki> ''<nowiki>]</nowiki>''</tt>
 +
: <tt>''<nowiki>]</nowiki>'' <nowiki>}}</nowiki></tt>
 +
Missing parameters (or completely empty parameters, without even any blank in the ''hours'' value) are treated like zero.
 +
 
 +
; Rationale<nowiki>:</nowiki>
 
The reason we separate out the "usual" difference from UTC and the DST adjustment is that the first part remains constant forever.
 
The reason we separate out the "usual" difference from UTC and the DST adjustment is that the first part remains constant forever.
  
Whereas the second part changes twice a year. This arrangement is the best way to minimize the number of pages we have to change when the clock changes. For example we can write
+
Whereas the second part changes twice a year.
: <nowiki> The current time in London is {{CurrentTimeIn|UsualDifferenceFromUTCForThisLocation = 0 | DSTAdjustment = {{CurrentDaylightSavingsOffsets/Europe}}</nowiki>
+
 
 +
This arrangement is the best way to minimize the number of pages we have to change when the clock changes.
 +
 
 +
; Examples<nowiki>:</nowiki>
 +
<pre>The current time in London is {{CurrentTimeIn|
 +
  UsualDifferenceFromUTCForThisLocation=0|
 +
  DSTAdjustment={{CurrentDaylightSavingsOffsets/Europe}}</pre>
 
and
 
and
: <nowiki> The current time in Paris is {{CurrentTimeIn|UsualDifferenceFromUTCForThisLocation = 1 | DSTAdjustment = {{CurrentDaylightSavingsOffsets/Europe}}</nowiki>
+
<pre>The current time in Paris is {{CurrentTimeIn|
and when the clocks change in Europe, the only page we have to change is {{tl|CurrentDaylightSavingsOffsets/Europe}} which is minimal number of pages. This template is usually wrapped by another template which controls the positioning of the time on the page. One example is {{tl|CurrentTimeInHeader}} which puts the time near the top of the page.
+
  UsualDifferenceFromUTCForThisLocation=1|
 +
  DSTAdjustment={{CurrentDaylightSavingsOffsets/Europe}}</pre>
 +
and when the clocks change in Europe, the only page we have to change is {{tl|CurrentDaylightSavingsOffsets/Europe}} which is minimal number of pages.
 +
 
 +
This template is usually wrapped by another template which controls the positioning of the time on the page. One example is {{tl|CurrentTimeInHeader}} which puts the time near the top of the page.
 +
 
 +
; See also<nowiki>:</nowiki>
 +
* [[Template:Utc]]
  
 +
[[Category:Date math|{{{PAGENAME}}]]
 
</noinclude>
 
</noinclude>

Revision as of 23:59, 24 April 2006

Template:Template documentation

This template prints the current UTC time offset by (UsualDifferenceFromUTCForThisLocation + DSTAdjustment) hours.

Syntax:
{{CurrentTimeIn [ |
[ UsualDifferenceFromUTCForThisLocation=hours| ]
[ DSTAdjustment=hours| ]
] }}

Missing parameters (or completely empty parameters, without even any blank in the hours value) are treated like zero.

Rationale:

The reason we separate out the "usual" difference from UTC and the DST adjustment is that the first part remains constant forever.

Whereas the second part changes twice a year.

This arrangement is the best way to minimize the number of pages we have to change when the clock changes.

Examples:
The current time in London is {{CurrentTimeIn|
  UsualDifferenceFromUTCForThisLocation=0|
  DSTAdjustment={{CurrentDaylightSavingsOffsets/Europe}}

and

The current time in Paris is {{CurrentTimeIn|
  UsualDifferenceFromUTCForThisLocation=1|
  DSTAdjustment={{CurrentDaylightSavingsOffsets/Europe}}

and when the clocks change in Europe, the only page we have to change is {{CurrentDaylightSavingsOffsets/Europe}} which is minimal number of pages.

This template is usually wrapped by another template which controls the positioning of the time on the page. One example is {{CurrentTimeInHeader}} which puts the time near the top of the page.

See also: