diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-01-27 10:47:28 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-01-27 10:47:28 +0100 |
commit | fc7de7136acbcf0aef54ae8460c7702bc83709be (patch) | |
tree | c109bb4dd1f1b054db476e7e4117f79bdd62ec9e /docs/content/en/functions/time/Format.md | |
parent | 1083bf7c08e6f35826279065b8a09a16cc991c7f (diff) | |
download | hugo-fc7de7136acbcf0aef54ae8460c7702bc83709be.tar.gz hugo-fc7de7136acbcf0aef54ae8460c7702bc83709be.zip |
docs: Prepare for new sub tree
See #11925
Diffstat (limited to 'docs/content/en/functions/time/Format.md')
-rw-r--r-- | docs/content/en/functions/time/Format.md | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/docs/content/en/functions/time/Format.md b/docs/content/en/functions/time/Format.md deleted file mode 100644 index 74384959b..000000000 --- a/docs/content/en/functions/time/Format.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: time.Format -description: Returns the given date/time as a formatted and localized string. -categories: [] -keywords: [] -action: - aliases: [dateFormat] - related: - - functions/time/AsTime - - functions/time/Duration - - functions/time/Now - - functions/time/ParseDuration - returnType: string - signatures: [time.Format LAYOUT INPUT] -aliases: [/functions/dateformat] -toc: true ---- - -Use the `time.Format` function with `time.Time` values: - -```go-html-template -{{ $t := time.AsTime "2023-02-27T23:44:58-08:00" }} -{{ time.Format "2 Jan 2006" $t }} → 27 Feb 2023 -``` - -Or use `time.Format` with a *parsable* string representation of a date/time value: - -```go-html-template -{{ $t := "27 Feb 2023" }} -{{ time.Format "January 2, 2006" $t }} → February 27, 2023 -``` - -Examples of parsable string representations: - -{{% include "functions/time/_common/parsable-date-time-strings.md" %}} - -## Layout string - -{{% include "functions/_common/time-layout-string.md" %}} - -## Localization - -Use the `time.Format` function to localize `time.Time` values for the current language and region. - -{{% include "functions/_common/locales.md" %}} - -Use the layout string as described above, or one of the tokens below. For example: - -```go-html-template -{{ .Date | time.Format ":date_medium" }} → Jan 27, 2023 -``` - -Localized to en-US: - -Token|Result -:--|:-- -`:date_full`|`Friday, January 27, 2023` -`:date_long`|`January 27, 2023` -`:date_medium`|`Jan 27, 2023` -`:date_short`|`1/27/23` -`:time_full`|`11:44:58 pm Pacific Standard Time` -`:time_long`|`11:44:58 pm PST` -`:time_medium`|`11:44:58 pm` -`:time_short`|`11:44 pm` - -Localized to de-DE: - -Token|Result -:--|:-- -`:date_full`|`Freitag, 27. Januar 2023` -`:date_long`|`27. Januar 2023` -`:date_medium`|`27.01.2023` -`:date_short`|`27.01.23` -`:time_full`|`23:44:58 Nordamerikanische Westküsten-Normalzeit` -`:time_long`|`23:44:58 PST` -`:time_medium`|`23:44:58` -`:time_short`|`23:44` |