Jump to content

Template:ConvertTime

From Wikinews, the free news source you can write!
[edit] Template documentation

Documentation

Template:ConvertTime is used to convert a given time from a specified timezone to Coordinated Universal Time (UTC) and format the output according to the Wikinews Style Guide.

Usage

This template should always be substituted to ensure the output is plain text rather than dynamic template code. Use the following syntax:

{{subst:#invoke:ConvertTime|convert|time=1:45 p.m.|timezone=CDT}}

When substituted, the output will be:

1:45 p.m. CDT (1845 UTC)

Parameters

  • time — The time to convert. This can be in 12-hour or 24-hour format (e.g., 1:45 p.m. or 13:45).
  • timezone — The timezone of the provided time. This should be an ISO 8601 timezone abbreviation (e.g., CDT, CET, AEST) or a UTC offset (e.g., UTC+3).

Timezone Handling

The module includes a table of common timezones:

  • North America: EST, EDT, CST, CDT, MST, MDT, PST, PDT
  • Europe: CET, CEST, BST, EET, EEST
  • Oceania: AEST, AEDT, ACST, AWST
  • Asia: IST, CST (China), JST, KST
  • Africa: SAST, EAT, WAT

If the template does not recognize the provided timezone, please use the UTC offset format instead (e.g., UTC+3).

To have additional timezones added, please make a request on the template talk page.

Error Handling

If an unrecognized timezone is entered, the template will display a red warning message. For unknown time conversions, it will show ???? UTC in place of the UTC time.

Example

{{subst:#invoke:ConvertTime|convert|time=10:30 a.m.|timezone=AEST}}

Output: 10:30 a.m. AEST (0030 UTC)

{{subst:#invoke:ConvertTime|convert|time=10:30 a.m.|timezone=UTC+10}}

Output: 10:30 a.m. local time (0030 UTC)

See also: Module:ConvertTime