Template:UTC offset/doc

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

This template returns a UTC offset string suitable for use with the {{#time:}} parser function:

{{UTC offset|MST}} → -6 hours

This template takes two parameters:

  • <timezone code> – (required) the first positional parameter specifies the timezone for which the offset is desired
  • |dst= – (optional) when set to no, suppresses daylight saving time adjustment

Valid <timezone code> values are the same as those supported by {{time}}.

Typical use of this template is with the {{#time:}} parser function:

{{#time:H:i}} → 01:58 – UTC time
{{UTC offset|MST}} → -6 hours – MST or MDT offset from UTC
{{#time:H:i | {{UTC offset|MST}} }} → 19:58 – MST or MDT time

Use |dst=no to get the UTC offset for areas that do not support daylight saving time but are located within timezones that do: Arizona (does not) is located within the Mountain Time Zone (does).

Supported time zones

[edit source]

{{#lst:Template:Time/doc|supported_time_zones}}

Error messages

[edit source]

This template can emit three error messages:

  • unknown timezone <unknown timezone> – this message emitted when <unknown timezone> is not a timezone known to Module:Time. To resolve this error, use a known timezone specifier.
  • missing required timezone – this template requires a timezone specifier. To resolve this error, provide a known timezone specifier.
  • error calculating dst timestamps – this template automatically applies daylight saving adjustment for those timezones that support it. This error message indicates that the underlying data in Module:Time/data for the timezone is malformed. To resolve this error, the underlying data must be corrected. This may be accomplished by anyone with administrator or template editor permission. Post a message at Template talk:Time.