Difference between revisions of "Template:CurrentTimeIn"
imported>Pcb21 |
imported>Pcb21 |
||
| Line 7: | Line 7: | ||
This template prints the current UTC time offset by ($UsualDifferenceFromUTCForThisLocation + $DSTAdjustment) hours. | This template prints the current UTC time offset by ($UsualDifferenceFromUTCForThisLocation + $DSTAdjustment) hours. | ||
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. | + | 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 |
| − | + | :<nowiki> The current time in London is {{CurrentTimeIn|UsualDifferenceFromUTCForThisLocation = 0 | DSTAdjustment = {{CurrentDaylightSavingsOffsets/Europe}}</nowiki> | |
| − | <nowiki> The current time in London is {{CurrentTimeIn|UsualDifferenceFromUTCForThisLocation = 0 | DSTAdjustment = {{CurrentDaylightSavingsOffsets/Europe}}</nowiki> | ||
and | and | ||
| − | <nowiki> The current time in Paris is {{CurrentTimeIn|UsualDifferenceFromUTCForThisLocation = 1 | DSTAdjustment = {{CurrentDaylightSavingsOffsets/Europe}}</nowiki> | + | :<nowiki> The current time in Paris is {{CurrentTimeIn|UsualDifferenceFromUTCForThisLocation = 1 | DSTAdjustment = {{CurrentDaylightSavingsOffsets/Europe}}</nowiki> |
| − | 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|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. |
| − | |||
| − | 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. | ||
</noinclude> | </noinclude> | ||
Revision as of 10:08, 16 April 2006
[[List of time zones|Template:Utc]]
This template prints the current UTC time offset by ($UsualDifferenceFromUTCForThisLocation + $DSTAdjustment) hours. 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
- 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.