summaryrefslogtreecommitdiffstats
path: root/docs/content/en/methods/time
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/methods/time')
-rw-r--r--docs/content/en/methods/time/Add.md11
-rw-r--r--docs/content/en/methods/time/AddDate.md18
-rw-r--r--docs/content/en/methods/time/After.md11
-rw-r--r--docs/content/en/methods/time/Before.md11
-rw-r--r--docs/content/en/methods/time/Day.md14
-rw-r--r--docs/content/en/methods/time/Equal.md11
-rw-r--r--docs/content/en/methods/time/Format.md31
-rw-r--r--docs/content/en/methods/time/Hour.md14
-rw-r--r--docs/content/en/methods/time/IsDST.md9
-rw-r--r--docs/content/en/methods/time/IsZero.md9
-rw-r--r--docs/content/en/methods/time/Local.md10
-rw-r--r--docs/content/en/methods/time/Minute.md14
-rw-r--r--docs/content/en/methods/time/Month.md14
-rw-r--r--docs/content/en/methods/time/Nanosecond.md9
-rw-r--r--docs/content/en/methods/time/Round.md11
-rw-r--r--docs/content/en/methods/time/Second.md14
-rw-r--r--docs/content/en/methods/time/Sub.md9
-rw-r--r--docs/content/en/methods/time/Truncate.md11
-rw-r--r--docs/content/en/methods/time/UTC.md10
-rw-r--r--docs/content/en/methods/time/Unix.md14
-rw-r--r--docs/content/en/methods/time/UnixMicro.md14
-rw-r--r--docs/content/en/methods/time/UnixMilli.md14
-rw-r--r--docs/content/en/methods/time/UnixNano.md14
-rw-r--r--docs/content/en/methods/time/Weekday.md11
-rw-r--r--docs/content/en/methods/time/Year.md14
-rw-r--r--docs/content/en/methods/time/YearDay.md8
-rw-r--r--docs/content/en/methods/time/_index.md6
27 files changed, 120 insertions, 216 deletions
diff --git a/docs/content/en/methods/time/Add.md b/docs/content/en/methods/time/Add.md
index 8fd755244..e518a1633 100644
--- a/docs/content/en/methods/time/Add.md
+++ b/docs/content/en/methods/time/Add.md
@@ -3,13 +3,10 @@ title: Add
description: Returns the given time plus the given duration.
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- - functions/time/Duration
- - functions/time/ParseDuration
- returnType: time.Time
- signatures: [TIME.Add DURATION]
+params:
+ functions_and_methods:
+ returnType: time.Time
+ signatures: [TIME.Add DURATION]
---
```go-html-template
diff --git a/docs/content/en/methods/time/AddDate.md b/docs/content/en/methods/time/AddDate.md
index 8537d6e25..ffc93c712 100644
--- a/docs/content/en/methods/time/AddDate.md
+++ b/docs/content/en/methods/time/AddDate.md
@@ -3,11 +3,10 @@ title: AddDate
description: Returns the time corresponding to adding the given number of years, months, and days to the given time.Time value.
categories: []
keywords: []
-action:
- aliases: []
- related: []
- returnType: time.Time
- signatures: [TIME.AddDate YEARS MONTHS DAYS]
+params:
+ functions_and_methods:
+ returnType: time.Time
+ signatures: [TIME.AddDate YEARS MONTHS DAYS]
aliases: [/functions/adddate]
---
@@ -21,11 +20,10 @@ aliases: [/functions/adddate]
{{ $d.AddDate -1 -1 -1 | time.Format "2006-01-02" }} → 2020-11-30
```
-{{% note %}}
-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.
-
-See [this explanation](https://github.com/golang/go/issues/31145#issuecomment-479067967) from the Go team.
-{{% /note %}}
+> [!note]
+> 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.
+>
+> See [this explanation](https://github.com/golang/go/issues/31145#issuecomment-479067967) from the Go team.
```go-html-template
{{ $d := "2023-01-31" | time.AsTime }}
diff --git a/docs/content/en/methods/time/After.md b/docs/content/en/methods/time/After.md
index 64c6cfe67..1c8d41f64 100644
--- a/docs/content/en/methods/time/After.md
+++ b/docs/content/en/methods/time/After.md
@@ -3,13 +3,10 @@ title: After
description: Reports whether TIME1 is after TIME2.
categories: []
keywords: []
-action:
- related:
- - methods/time/Before
- - methods/time/Equal
- - functions/time/AsTime
- returnType: bool
- signatures: [TIME1.After TIME2]
+params:
+ functions_and_methods:
+ returnType: bool
+ signatures: [TIME1.After TIME2]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Before.md b/docs/content/en/methods/time/Before.md
index c3d582860..f6dc3a8e7 100644
--- a/docs/content/en/methods/time/Before.md
+++ b/docs/content/en/methods/time/Before.md
@@ -3,13 +3,10 @@ title: Before
description: Reports whether TIME1 is before TIME2.
categories: []
keywords: []
-action:
- related:
- - methods/time/After
- - methods/time/Equal
- - functions/time/AsTime
- returnType: bool
- signatures: [TIME1.Before TIME2]
+params:
+ functions_and_methods:
+ returnType: bool
+ signatures: [TIME1.Before TIME2]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Day.md b/docs/content/en/methods/time/Day.md
index 1173b8489..e9e67873c 100644
--- a/docs/content/en/methods/time/Day.md
+++ b/docs/content/en/methods/time/Day.md
@@ -3,16 +3,10 @@ title: Day
description: Returns the day of the month of the given time.Time value.
categories: []
keywords: []
-action:
- related:
- - methods/time/Year
- - methods/time/Month
- - methods/time/Hour
- - methods/time/Minute
- - methods/time/Second
- - functions/time/AsTime
- returnType: int
- signatures: [TIME.Day]
+params:
+ functions_and_methods:
+ returnType: int
+ signatures: [TIME.Day]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Equal.md b/docs/content/en/methods/time/Equal.md
index 4d45a3ada..6db10423c 100644
--- a/docs/content/en/methods/time/Equal.md
+++ b/docs/content/en/methods/time/Equal.md
@@ -3,13 +3,10 @@ title: Equal
description: Reports whether TIME1 is equal to TIME2.
categories: []
keywords: []
-action:
- related:
- - methods/time/After
- - methods/time/Before
- - functions/time/AsTime
- returnType: bool
- signatures: [TIME1.Equal TIME2]
+params:
+ functions_and_methods:
+ returnType: bool
+ signatures: [TIME1.Equal TIME2]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Format.md b/docs/content/en/methods/time/Format.md
index 9a718b53b..8a484b74e 100644
--- a/docs/content/en/methods/time/Format.md
+++ b/docs/content/en/methods/time/Format.md
@@ -3,15 +3,10 @@ title: Format
description: Returns a textual representation of the time.Time value formatted according to the layout string.
categories: []
keywords: []
-action:
- aliases: []
- related:
- - functions/time/AsTime
- - methods/time/UTC
- - methods/time/Local
- returnType: string
- signatures: [TIME.Format LAYOUT]
-toc: true
+params:
+ functions_and_methods:
+ returnType: string
+ signatures: [TIME.Format LAYOUT]
aliases: [/methods/time/format]
---
@@ -23,11 +18,8 @@ aliases: [/methods/time/format]
{{ $t.Format $format }} → 27 Jan 2023
```
-{{% note %}}
-To [localize](g) the return value, use the [`time.Format`] function instead.
-
-[`time.Format`]: /functions/time/format/
-{{% /note %}}
+> [!note]
+> To [localize](g) 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:
@@ -40,15 +32,12 @@ Use the `Format` method with any `time.Time` value, including the four predefine
{{ .Lastmod.Format $format }}
```
-{{% note %}}
-Use the [`time.Format`] function to format string representations of dates, and to format raw TOML dates that exclude time and time zone offset.
-
-[`time.Format`]: /functions/time/format/
-{{% /note %}}
+> [!note]
+> Use the [`time.Format`] function to format string representations of dates, and to format raw TOML dates that exclude time and time zone offset.
## Layout string
-{{% include "functions/_common/time-layout-string.md" %}}
+{{% include "/_common/time-layout-string.md" %}}
## Examples
@@ -95,3 +84,5 @@ Use the [`humanize`](/functions/inflect/humanize) function to render the day of
{{ humanize $t.Day }} of {{ $t.Format "January 2006" }} → 27th of January 2023
```
+
+[`time.Format`]: /functions/time/format/
diff --git a/docs/content/en/methods/time/Hour.md b/docs/content/en/methods/time/Hour.md
index 58ed00260..28ecf62ac 100644
--- a/docs/content/en/methods/time/Hour.md
+++ b/docs/content/en/methods/time/Hour.md
@@ -3,16 +3,10 @@ title: Hour
description: Returns the hour within the day of the given time.Time value, in the range [0, 23].
categories: []
keywords: []
-action:
- related:
- - methods/time/Year
- - methods/time/Month
- - methods/time/Day
- - methods/time/Minute
- - methods/time/Second
- - functions/time/AsTime
- returnType: int
- signatures: [TIME.Hour]
+params:
+ functions_and_methods:
+ returnType: int
+ signatures: [TIME.Hour]
---
```go-html-template
diff --git a/docs/content/en/methods/time/IsDST.md b/docs/content/en/methods/time/IsDST.md
index df2b84cae..28177b105 100644
--- a/docs/content/en/methods/time/IsDST.md
+++ b/docs/content/en/methods/time/IsDST.md
@@ -3,11 +3,10 @@ title: IsDST
description: Reports whether the given time.Time value is in Daylight Savings Time.
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- returnType: bool
- signatures: [TIME.IsDST]
+params:
+ functions_and_methods:
+ returnType: bool
+ signatures: [TIME.IsDST]
---
```go-html-template
diff --git a/docs/content/en/methods/time/IsZero.md b/docs/content/en/methods/time/IsZero.md
index 2026f3b2e..400172794 100644
--- a/docs/content/en/methods/time/IsZero.md
+++ b/docs/content/en/methods/time/IsZero.md
@@ -3,11 +3,10 @@ title: IsZero
description: Reports whether the given time.Time value represents the zero time instant, January 1, year 1, 00:00:00 UTC.
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- returnType: bool
- signatures: [TIME.IsZero]
+params:
+ functions_and_methods:
+ returnType: bool
+ signatures: [TIME.IsZero]
---
````go-html-template
diff --git a/docs/content/en/methods/time/Local.md b/docs/content/en/methods/time/Local.md
index bd40e3a44..74fe889e0 100644
--- a/docs/content/en/methods/time/Local.md
+++ b/docs/content/en/methods/time/Local.md
@@ -3,12 +3,10 @@ title: Local
description: Returns the given time.Time value with the location set to local time.
categories: []
keywords: []
-action:
- related:
- - methods/time/UTC
- - functions/time/AsTime
- returnType: time.Time
- signatures: [TIME.Local]
+params:
+ functions_and_methods:
+ returnType: time.Time
+ signatures: [TIME.Local]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Minute.md b/docs/content/en/methods/time/Minute.md
index d482fab5d..b53db6d83 100644
--- a/docs/content/en/methods/time/Minute.md
+++ b/docs/content/en/methods/time/Minute.md
@@ -3,16 +3,10 @@ title: Minute
description: Returns the minute offset within the hour of the given time.Time value, in the range [0, 59].
categories: []
keywords: []
-action:
- related:
- - methods/time/Year
- - methods/time/Month
- - methods/time/Day
- - methods/time/Hour
- - methods/time/Second
- - functions/time/AsTime
- returnType: int
- signatures: [TIME.Minute]
+params:
+ functions_and_methods:
+ returnType: int
+ signatures: [TIME.Minute]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Month.md b/docs/content/en/methods/time/Month.md
index 0a01d1a70..b0ccea9c3 100644
--- a/docs/content/en/methods/time/Month.md
+++ b/docs/content/en/methods/time/Month.md
@@ -3,16 +3,10 @@ title: Month
description: Returns the month of the year of the given time.Time value.
categories: []
keywords: []
-action:
- related:
- - methods/time/Year
- - methods/time/Day
- - methods/time/Hour
- - methods/time/Minute
- - methods/time/Second
- - functions/time/AsTime
- returnType: time.Month
- signatures: [TIME.Month]
+params:
+ functions_and_methods:
+ returnType: time.Month
+ signatures: [TIME.Month]
---
To convert the `time.Month` value to a string:
diff --git a/docs/content/en/methods/time/Nanosecond.md b/docs/content/en/methods/time/Nanosecond.md
index 606143139..d895f9622 100644
--- a/docs/content/en/methods/time/Nanosecond.md
+++ b/docs/content/en/methods/time/Nanosecond.md
@@ -3,11 +3,10 @@ title: Nanosecond
description: Returns the nanosecond offset within the second of the given time.Time value, in the range [0, 999999999].
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- returnType: int
- signatures: [TIME.Nanosecond]
+params:
+ functions_and_methods:
+ returnType: int
+ signatures: [TIME.Nanosecond]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Round.md b/docs/content/en/methods/time/Round.md
index 16bd2009f..816d41b44 100644
--- a/docs/content/en/methods/time/Round.md
+++ b/docs/content/en/methods/time/Round.md
@@ -3,13 +3,10 @@ title: Round
description: Returns the result of rounding TIME to the nearest multiple of DURATION since January 1, 0001, 00:00:00 UTC.
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- - functions/time/ParseDuration
- - methods/time/Truncate
- returnType: time.Time
- signatures: [TIME.Round DURATION]
+params:
+ functions_and_methods:
+ returnType: time.Time
+ signatures: [TIME.Round DURATION]
---
The rounding behavior for halfway values is to round up.
diff --git a/docs/content/en/methods/time/Second.md b/docs/content/en/methods/time/Second.md
index e326c64bc..3af086fd3 100644
--- a/docs/content/en/methods/time/Second.md
+++ b/docs/content/en/methods/time/Second.md
@@ -3,16 +3,10 @@ title: Second
description: Returns the second offset within the minute of the given time.Time value, in the range [0, 59].
categories: []
keywords: []
-action:
- related:
- - methods/time/Year
- - methods/time/Month
- - methods/time/Day
- - methods/time/Hour
- - methods/time/Minute
- - functions/time/AsTime
- returnType: int
- signatures: [TIME.Second]
+params:
+ functions_and_methods:
+ returnType: int
+ signatures: [TIME.Second]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Sub.md b/docs/content/en/methods/time/Sub.md
index 9678365eb..d48bf3467 100644
--- a/docs/content/en/methods/time/Sub.md
+++ b/docs/content/en/methods/time/Sub.md
@@ -3,11 +3,10 @@ title: Sub
description: Returns the duration computed by subtracting TIME2 from TIME1.
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- returnType: time.Duration
- signatures: [TIME1.Sub TIME2]
+params:
+ functions_and_methods:
+ returnType: time.Duration
+ signatures: [TIME1.Sub TIME2]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Truncate.md b/docs/content/en/methods/time/Truncate.md
index 64751f2c1..b797afec0 100644
--- a/docs/content/en/methods/time/Truncate.md
+++ b/docs/content/en/methods/time/Truncate.md
@@ -3,13 +3,10 @@ title: Truncate
description: Returns the result of rounding TIME down to a multiple of DURATION since January 1, 0001, 00:00:00 UTC.
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- - functions/time/ParseDuration
- - methods/time/Round
- returnType: time.Time
- signatures: [TIME.Truncate DURATION]
+params:
+ functions_and_methods:
+ returnType: time.Time
+ signatures: [TIME.Truncate DURATION]
---
The `Truncate` method operates on TIME as an absolute duration since the [zero time](g); it does not operate on the presentation form of the time. If DURATION is a multiple of one hour, `Truncate` may return a time with a non-zero minute, depending on the time zone.
diff --git a/docs/content/en/methods/time/UTC.md b/docs/content/en/methods/time/UTC.md
index 6fd7b526d..e131a003e 100644
--- a/docs/content/en/methods/time/UTC.md
+++ b/docs/content/en/methods/time/UTC.md
@@ -3,12 +3,10 @@ title: UTC
description: Returns the given time.Time value with the location set to UTC.
categories: []
keywords: []
-action:
- related:
- - methods/time/Local
- - functions/time/AsTime
- returnType: time.Time
- signatures: [TIME.UTC]
+params:
+ functions_and_methods:
+ returnType: time.Time
+ signatures: [TIME.UTC]
---
```go-html-template
diff --git a/docs/content/en/methods/time/Unix.md b/docs/content/en/methods/time/Unix.md
index fcfc661fe..73deb524e 100644
--- a/docs/content/en/methods/time/Unix.md
+++ b/docs/content/en/methods/time/Unix.md
@@ -1,15 +1,11 @@
---
title: Unix
-description: Returns the given time.Time value expressed as the number of seconds elapsed since January 1, 1970 UTC.
+description: Returns the given time.Time value expressed as the number of seconds elapsed since January 1, 1970 UTC.
categories: []
-action:
- related:
- - methods/time/UnixMilli
- - methods/time/UnixMicro
- - methods/time/UnixNano
- - functions/time/AsTime
- returnType: int64
- signatures: [TIME.Unix]
+params:
+ functions_and_methods:
+ returnType: int64
+ signatures: [TIME.Unix]
aliases: [/functions/unix]
---
diff --git a/docs/content/en/methods/time/UnixMicro.md b/docs/content/en/methods/time/UnixMicro.md
index 150497cd3..fadb0916c 100644
--- a/docs/content/en/methods/time/UnixMicro.md
+++ b/docs/content/en/methods/time/UnixMicro.md
@@ -1,16 +1,12 @@
---
title: UnixMicro
-description: Returns the given time.Time value expressed as the number of microseconds elapsed since January 1, 1970 UTC.
+description: Returns the given time.Time value expressed as the number of microseconds elapsed since January 1, 1970 UTC.
categories: []
keywords: []
-action:
- related:
- - methods/time/Unix
- - methods/time/UnixMilli
- - methods/time/UnixNano
- - functions/time/AsTime
- returnType: int64
- signatures: [TIME.UnixMicro]
+params:
+ functions_and_methods:
+ returnType: int64
+ signatures: [TIME.UnixMicro]
---
See [Unix epoch](https://en.wikipedia.org/wiki/Unix_time).
diff --git a/docs/content/en/methods/time/UnixMilli.md b/docs/content/en/methods/time/UnixMilli.md
index e5e90ba25..9d2261d91 100644
--- a/docs/content/en/methods/time/UnixMilli.md
+++ b/docs/content/en/methods/time/UnixMilli.md
@@ -1,16 +1,12 @@
---
title: UnixMilli
-description: Returns the given time.Time value expressed as the number of milliseconds elapsed since January 1, 1970 UTC.
+description: Returns the given time.Time value expressed as the number of milliseconds elapsed since January 1, 1970 UTC.
categories: []
keywords: []
-action:
- related:
- - methods/time/Unix
- - methods/time/UnixMicro
- - methods/time/UnixNano
- - functions/time/AsTime
- returnType: int64
- signatures: [TIME.UnixMilli]
+params:
+ functions_and_methods:
+ returnType: int64
+ signatures: [TIME.UnixMilli]
---
See [Unix epoch](https://en.wikipedia.org/wiki/Unix_time).
diff --git a/docs/content/en/methods/time/UnixNano.md b/docs/content/en/methods/time/UnixNano.md
index 63db320a3..4159ddee2 100644
--- a/docs/content/en/methods/time/UnixNano.md
+++ b/docs/content/en/methods/time/UnixNano.md
@@ -1,16 +1,12 @@
---
title: UnixNano
-description: Returns the given time.Time value expressed as the number of nanoseconds elapsed since January 1, 1970 UTC.
+description: Returns the given time.Time value expressed as the number of nanoseconds elapsed since January 1, 1970 UTC.
categories: []
keywords: []
-action:
- related:
- - methods/time/Unix
- - methods/time/UnixMilli
- - methods/time/UnixMicro
- - functions/time/AsTime
- returnType: int64
- signatures: [TIME.UnixNano]
+params:
+ functions_and_methods:
+ returnType: int64
+ signatures: [TIME.UnixNano]
---
See [Unix epoch](https://en.wikipedia.org/wiki/Unix_time).
diff --git a/docs/content/en/methods/time/Weekday.md b/docs/content/en/methods/time/Weekday.md
index b2a95fe9c..da939ff87 100644
--- a/docs/content/en/methods/time/Weekday.md
+++ b/docs/content/en/methods/time/Weekday.md
@@ -1,13 +1,12 @@
---
title: Weekday
-description: Returns the day of the week of the given time.Time value.
+description: Returns the day of the week of the given time.Time value.
categories: []
keywords: []
-action:
- related:
- - functions/time/AsTime
- returnType: time.Weekday
- signatures: [TIME.Weekday]
+params:
+ functions_and_methods:
+ returnType: time.Weekday
+ signatures: [TIME.Weekday]
---
To convert the `time.Weekday` value to a string:
diff --git a/docs/content/en/methods/time/Year.md b/docs/content/en/methods/time/Year.md
index b046896f4..3f647ea34 100644
--- a/docs/content/en/methods/time/Year.md
+++ b/docs/content/en/methods/time/Year.md
@@ -3,16 +3,10 @@ title: Year
description: Returns the year of the given time.Time value.
categories: []
keywords: []
-action:
- related:
- - methods/time/Month
- - methods/time/Day
- - methods/time/Hour
- - methods/time/Minute
- - methods/time/Second
- - functions/time/AsTime
- returnType: int
- signatures: [TIME.Year]
+params:
+ functions_and_methods:
+ returnType: int
+ signatures: [TIME.Year]
---
```go-html-template
diff --git a/docs/content/en/methods/time/YearDay.md b/docs/content/en/methods/time/YearDay.md
index f380cdffe..a93158b45 100644
--- a/docs/content/en/methods/time/YearDay.md
+++ b/docs/content/en/methods/time/YearDay.md
@@ -3,10 +3,10 @@ title: YearDay
description: Returns the day of the year of the given time.Time value, in the range [1, 365] for non-leap years, and [1, 366] in leap years.
categories: []
keywords: []
-action:
- related: []
- returnType: int
- signatures: [TIME.YearDay]
+params:
+ functions_and_methods:
+ returnType: int
+ signatures: [TIME.YearDay]
---
```go-html-template
diff --git a/docs/content/en/methods/time/_index.md b/docs/content/en/methods/time/_index.md
index 81d4690e0..8114664d3 100644
--- a/docs/content/en/methods/time/_index.md
+++ b/docs/content/en/methods/time/_index.md
@@ -4,10 +4,4 @@ linkTitle: Time
description: Use these methods with time.Time values.
categories: []
keywords: []
-menu:
- docs:
- identifier: time-methods
- parent: methods
---
-
-Use these methods with time.Time values.