mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Merge commit 'aa5ac36a3eb68b86c803caec703869efefc8447e'
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: time.Format
|
||||
description: Converts a date/time to a localized string.
|
||||
godocref: https://golang.org/pkg/time/
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
@@ -23,7 +22,7 @@ deprecated: false
|
||||
{{ time.Format "Monday, Jan 2, 2006" "2015-01-21" }} → "Wednesday, Jan 21, 2015"
|
||||
```
|
||||
|
||||
Note that since Hugo 0.87.0, `time.Format` will return a localized string for the currrent language. {{< new-in "0.87.0" >}}
|
||||
Note that since Hugo 0.87.0, `time.Format` will return a localized string for the current language. {{< new-in "0.87.0" >}}
|
||||
|
||||
The `LAYOUT` string can be either:
|
||||
|
||||
@@ -37,7 +36,7 @@ See the [`time` function](/functions/time/) to convert a timestamp string to a G
|
||||
|
||||
{{< new-in "0.87.0" >}}
|
||||
|
||||
Go's date layout strings can be hard to reason about, especially with multiple languages. Since Hugo 0.87.0 you can alternatively use some predefined layout idenfifiers that will output localized dates or times:
|
||||
Go's date layout strings can be hard to reason about, especially with multiple languages. Since Hugo 0.87.0 you can alternatively use some predefined layout identifiers that will output localized dates or times:
|
||||
|
||||
```go-html-template
|
||||
{{ .Date | time.Format ":date_long" }}
|
||||
|
Reference in New Issue
Block a user