Difference between revisions of "Template:CurrentTimeIn"

From blackwiki
Jump to navigation Jump to search
imported>Verdy p
m (sort key for category)
imported>Patrick
(Current daylight saving offset in Europe)
Line 1: Line 1:
<includeonly>[[List of time zones|{{utc|{{#expr:({{{UsualDifferenceFromUTCForThisLocation|0}}})+({{{DSTAdjustment|0}}})}}}}]]</includeonly><noinclude>{{Template documentation}}
+
<includeonly>[[List of time zones|{{utc|{{#expr:({{{UsualDifferenceFromUTCForThisLocation|0}}})+({{{DSTAdjustment|0}}})}}}}]]</includeonly><noinclude>{{
  
 
This template prints the current UTC time offset by (UsualDifferenceFromUTCForThisLocation + DSTAdjustment) hours.
 
This template prints the current UTC time offset by (UsualDifferenceFromUTCForThisLocation + DSTAdjustment) hours.
Line 20: Line 20:
 
<pre>The current time in London is {{CurrentTimeIn|
 
<pre>The current time in London is {{CurrentTimeIn|
 
   UsualDifferenceFromUTCForThisLocation=0|
 
   UsualDifferenceFromUTCForThisLocation=0|
   DSTAdjustment={{CurrentDaylightSavingsOffsets/Europe}}</pre>
+
   DSTAdjustment={{Current daylight saving offset in Europe}}</pre>
 
and
 
and
 
<pre>The current time in Paris is {{CurrentTimeIn|
 
<pre>The current time in Paris is {{CurrentTimeIn|
 
   UsualDifferenceFromUTCForThisLocation=1|
 
   UsualDifferenceFromUTCForThisLocation=1|
   DSTAdjustment={{CurrentDaylightSavingsOffsets/Europe}}</pre>
+
   DSTAdjustment={{Current daylight saving offset in 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.
+
and when the clocks change in Europe, the only page we have to change is {{tl|Current daylight saving offset in 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.
 
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.
Line 32: Line 32:
 
* [[Template:Utc]]
 
* [[Template:Utc]]
  
 +
Template documentation}}
 
[[Category:Date math|{{PAGENAME}}]]
 
[[Category:Date math|{{PAGENAME}}]]
 
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
 
[[Category:Templates using ParserFunctions|{{PAGENAME}}]]
 
</noinclude>
 
</noinclude>

Revision as of 16:55, 19 May 2006

{{

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={{Current daylight saving offset in Europe}}

and

The current time in Paris is {{CurrentTimeIn|
  UsualDifferenceFromUTCForThisLocation=1|
  DSTAdjustment={{Current daylight saving offset in Europe}}

and when the clocks change in Europe, the only page we have to change is {{Current daylight saving offset in 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:

Template documentation}}