localtime extension example
The localtime shortcode displays a given date and time in the reader’s local timezone. Times on this page update to your local time when the page loads.
In context
Here is how the shortcode looks inline in prose:
Join us for our next meetup, which starts at 2026-09-18 14:00 UTC.
Basic usage
| Shortcode | Renders locally as |
|---|---|
{{< localtime 2026-01-30 13:00 UTC >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 EST >}} |
2026-01-30 13:00 EST |
{{< localtime 2026-01-30 13:00 -05:00 >}} |
2026-01-30 13:00 -05:00 |
{{< localtime 2026-06-15 09:00 UTC >}} |
2026-06-15 09:00 UTC |
Timezone input formats
Three formats refer to the same timezone — abbreviation, IANA name, and UTC offset. These three shortcodes all produce the same output:
| Shortcode | Renders locally as |
|---|---|
{{< localtime 2026-01-30 13:00 EST >}} |
2026-01-30 13:00 EST |
{{< localtime 2026-01-30 13:00 America/New_York >}} |
2026-01-30 13:00 America/New_York |
{{< localtime 2026-01-30 13:00 -05:00 >}} |
2026-01-30 13:00 -05:00 |
IANA names are unambiguous and recommended when precision matters. UTC offsets are useful for timezones without a standard abbreviation or for regions that don’t observe DST.
DST handling
DST is handled automatically in the reader’s browser. Abbreviations like EST and CET are mapped to their IANA timezone, so the browser applies the correct offset for each date — winter dates use the standard offset, summer dates use the DST offset.
| Shortcode | Renders locally as |
|---|---|
{{< localtime 2026-01-15 14:00 CET >}} (winter) |
2026-01-15 14:00 CET |
{{< localtime 2026-07-15 14:00 CET >}} (summer) |
2026-07-15 14:00 CET |
{{< localtime 2026-01-15 09:00 EST >}} (winter) |
2026-01-15 09:00 EST |
{{< localtime 2026-07-15 09:00 EST >}} (summer) |
2026-07-15 09:00 EST |
The winter and summer rows for the same abbreviation convert to different UTC offsets (e.g. CET vs CEST, EST vs EDT).
12-hour time input
The time argument can be given in 12-hour format by appending am or pm. These two syntaxes — attached and space-separated — produce identical output:
| Shortcode | Renders locally as |
|---|---|
{{< localtime 2026-01-30 1:00pm EST >}} |
2026-01-30 1:00pm EST |
{{< localtime 2026-01-30 1:00 PM EST >}} |
2026-01-30 1:00 PM EST |
Both are accepted syntaxes; am/pm is case-insensitive.
Format presets
Use the format argument to control the output. If omitted, datetime is used.
| Shortcode | Renders locally as |
|---|---|
{{< localtime 2026-01-30 13:00 UTC >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="datetime" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="date" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="time" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="time12" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="datetime12" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="full" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="full12" >}} |
2026-01-30 13:00 UTC |
The 12 variants use 12-hour clock with no leading zero and lowercase am/pm (e.g. 1:00pm).
Custom format strings
Use %-style tokens to build your own format. The - flag removes zero-padding.
| Shortcode | Renders locally as |
|---|---|
{{< localtime 2026-01-30 13:00 UTC format="%d %B at %H:%M" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="%A, %d %B %Y" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-30 13:00 UTC format="%H:%M %Z" >}} |
2026-01-30 13:00 UTC |
{{< localtime 2026-01-03 08:05 UTC format="%d %B %Y at %H:%M" >}} |
2026-01-03 08:05 UTC |
{{< localtime 2026-01-03 08:05 UTC format="%-d %B %Y at %-H:%M" >}} |
2026-01-03 08:05 UTC |
The last two rows use the same date (2026-01-03) and time (08:05) — the first with zero-padded %d and %H, the second with no-padding %-d and %-H.