HUGO
Menu
GitHub 90498 stars Mastodon

time.In

Returns the given date/time as represented in the specified IANA time zone.
Syntax
time.In TIMEZONE INPUT
Returns
time.Time
New in v0.146.0

Usage

The time.In function returns the given date/time as represented in the specified IANA time zone.

Arguments

TIMEZONE
(string) The time zone. Use an empty string or UTC for UTC, Local for the system’s local time zone, or any valid IANA time zone name.
INPUT
(time.Time) The date/time value. To use a string representation of a date/time value, such as a custom date parameter in front matter, convert it with the time.AsTime function first.

Examples

{{ $layout := "2006-01-02T15:04:05-07:00" }}
{{ $t := time "2025-03-31T14:45:00-00:00" }}

{{ $t | time.In "America/Denver" | dateFormat $layout }}     → 2025-03-31T08:45:00-06:00
{{ $t | time.In "Australia/Adelaide" | dateFormat $layout }} → 2025-04-01T01:15:00+10:30
{{ $t | time.In "Europe/Oslo" | dateFormat $layout }}        → 2025-03-31T16:45:00+02:00