<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Time methods on Hugo</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/</link><description>Recent content in Time methods on Hugo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://v0-122-0--gohugoio.netlify.app/methods/time/index.xml" rel="self" type="application/rss+xml"/><item><title>Add</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/add/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/add/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $d1 = time.ParseDuration &amp;#34;3h20m10s&amp;#34; }} {{ $d2 = time.ParseDuration &amp;#34;-3h20m10s&amp;#34; }} {{ $t.Add $d1 }} → 2023-01-28 03:05:08 -0800 PST {{ $t.Add $d2 }} → 2023-01-27 20:24:48 -0800 PST</description></item><item><title>AddDate</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/adddate/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/adddate/</guid><description>{{ $d := &amp;#34;2022-01-01&amp;#34; | time.AsTime }} {{ $d.AddDate 0 0 1 | time.Format &amp;#34;2006-01-02&amp;#34; }} → 2022-01-02 {{ $d.AddDate 0 1 1 | time.Format &amp;#34;2006-01-02&amp;#34; }} → 2022-02-02 {{ $d.AddDate 1 1 1 | time.Format &amp;#34;2006-01-02&amp;#34; }} → 2023-02-02 {{ $d.AddDate -1 -1 -1 | time.Format &amp;#34;2006-01-02&amp;#34; }} → 2020-11-30 When adding months or years, Hugo normalizes the final time.Time value if the resulting day does not exist. For example, adding one month to 31 January produces 2 March or 3 March, depending on the year.</description></item><item><title>After</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/after/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/after/</guid><description>{{ $t1 := time.AsTime &amp;#34;2023-01-01T17:00:00-08:00&amp;#34; }} {{ $t2 := time.AsTime &amp;#34;2010-01-01T17:00:00-08:00&amp;#34; }} {{ $t1.After $t2 }} → true</description></item><item><title>Before</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/before/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/before/</guid><description>{{ $t1 := time.AsTime &amp;#34;2023-01-01T17:00:00-08:00&amp;#34; }} {{ $t2 := time.AsTime &amp;#34;2030-01-01T17:00:00-08:00&amp;#34; }} {{ $t1.Before $t2 }} → true</description></item><item><title>Day</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/day/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/day/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Day }} → 27</description></item><item><title>Equal</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/equal/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/equal/</guid><description>{{ $t1 := time.AsTime &amp;#34;2023-01-01T17:00:00-08:00&amp;#34; }} {{ $t2 := time.AsTime &amp;#34;2023-01-01T20:00:00-05:00&amp;#34; }} {{ $t1.Equal $t2 }} → true</description></item><item><title>Format</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/format/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/format/</guid><description>{{ $t := &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t = time.AsTime $t }} {{ $format := &amp;#34;2 Jan 2006&amp;#34; }} {{ $t.Format $format }} → 27 Jan 2023 To localize the return value, use the time.Format function instead.
Use the Format method with any time.Time value, including the four predefined front matter dates:
{{ $format := &amp;#34;2 Jan 2006&amp;#34; }} {{ .Date.Format $format }} {{ .PublishDate.Format $format }} {{ .ExpiryDate.Format $format }} {{ .</description></item><item><title>Hour</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/hour/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/hour/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Hour }} → 23</description></item><item><title>IsDST</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/isdst/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/isdst/</guid><description>{{ $t1 := time.AsTime &amp;#34;2023-01-01T00:00:00-08:00&amp;#34; }} {{ $t2 := time.AsTime &amp;#34;2023-07-01T00:00:00-07:00&amp;#34; }} {{ $t1.IsDST }} → false {{ $t2.IsDST }} → true</description></item><item><title>IsZero</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/iszero/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/iszero/</guid><description>{{ $t1 := time.AsTime &amp;#34;2023-01-01T00:00:00-08:00&amp;#34; }} {{ $t2 := time.AsTime &amp;#34;0001-01-01T00:00:00-00:00&amp;#34; }} {{ $t1.IsZero }} → false {{ $t2.IsZero }} → true ```</description></item><item><title>Local</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/local/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/local/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-28T07:44:58+00:00&amp;#34; }} {{ $t.Local }} → 2023-01-27 23:44:58 -0800 PST</description></item><item><title>Minute</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/minute/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/minute/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Minute }} → 44</description></item><item><title>Month</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/month/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/month/</guid><description>To convert the time.Month value to a string:
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Month.String }} → January To convert the time.Month value to an integer.
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Month | int }} → 1</description></item><item><title>Nanosecond</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/nanosecond/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/nanosecond/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Nanosecond }} → 0</description></item><item><title>Second</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/second/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/second/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Second }} → 58</description></item><item><title>Sub</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/sub/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/sub/</guid><description>{{ $t1 := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t2 := time.AsTime &amp;#34;2023-01-26T22:34:38-08:00&amp;#34; }} {{ $t1.Sub $t2 }} → 25h10m20s</description></item><item><title>Unix</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/unix/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/unix/</guid><description>See Unix epoch.
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Unix }} → 1674891898</description></item><item><title>UnixMicro</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/unixmicro/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/unixmicro/</guid><description>See Unix epoch.
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.UnixMicro }} → 1674891898000000</description></item><item><title>UnixMilli</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/unixmilli/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/unixmilli/</guid><description>See Unix epoch.
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.UnixMilli }} → 1674891898000</description></item><item><title>UnixNano</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/unixnano/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/unixnano/</guid><description>See Unix epoch.
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.UnixNano }} → 1674891898000000000</description></item><item><title>UTC</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/utc/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/utc/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.UTC }} → 2023-01-28 07:44:58 +0000 UTC</description></item><item><title>Weekday</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/weekday/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/weekday/</guid><description>To convert the time.Weekday value to a string:
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Weekday.String }} → Friday To convert the time.Weekday value to an integer.
{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Weekday | int }} → 5</description></item><item><title>Year</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/year/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/year/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.Year }} → 2023</description></item><item><title>YearDay</title><link>https://v0-122-0--gohugoio.netlify.app/methods/time/yearday/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/methods/time/yearday/</guid><description>{{ $t := time.AsTime &amp;#34;2023-01-27T23:44:58-08:00&amp;#34; }} {{ $t.YearDay }} → 27</description></item></channel></rss>