Clarify time.Format method

This commit is contained in:
Joe Mooring 2023-11-22 11:56:30 -08:00 committed by GitHub
parent f7bd43ae1a
commit 5c41f0bf81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
---
title: Format
description: Returns a formatted time.Time value.
description: Returns a textual representation of the time.Time value formatted according to the layout string.
categories: []
keywords: []
action:
@ -24,8 +24,9 @@ aliases: [/methods/time/format]
```
{{% note %}}
To return a formatted and localized `time.Time` value, use the [`time.Format`] function instead.
To [localize] the return value, use the [`time.Format`] function instead.
[localize]: /getting-started/glossary/#localization
[`time.Format`]: /functions/time/format
{{% /note %}}
@ -40,6 +41,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 %}}
## Layout string
{{% include "functions/_common/time-layout-string.md" %}}