From 0554cb31e99a2008789f677fe36704088f2463b9 Mon Sep 17 00:00:00 2001 From: Riaz Laskar Date: Wed, 31 Mar 2021 14:07:02 +0530 Subject: [PATCH] docs: time format indications --- docs/docs/segment-time.md | 40 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/docs/docs/segment-time.md b/docs/docs/segment-time.md index 8e0609277455..82517f4a11b5 100644 --- a/docs/docs/segment-time.md +++ b/docs/docs/segment-time.md @@ -25,13 +25,49 @@ Show the current timestamp. - time_format: `string` - format to use, follows the [golang standard][format] - defaults to `15:04:05` -[format]: https://gobyexample.com/time-formatting-parsing +[format]: https://yourbasic.org/golang/format-parse-string-time-date-example/ - template: `string` - A go [text/template][go-text-template] template extended with [sprig][sprig] utilizing the -properties below. Only used when a value is set, making the above properties obsolete. + properties below. Only used when a value is set, making the above properties obsolete. example: `{{ now | date \"January 02, 2006 15:04:05 PM\" | lower }}` ## Template Properties - `.CurrentDate`: `time` - The time to display(testing purpose) + +### Standard time and date formats + +- January 2, 2006 **Date** +- 01/02/06 +- Jan-02-06 +- 15:04:05 **Time** +- 3:04:05 PM +- Jan _2 15:04:05 **Timestamp** +- Jan _2 15:04:05.000000 **with microseconds** +- 2006-01-02T15:04:05-0700 **ISO 8601 (RFC 3339)** +- 2006-01-02 +- 15:04:05 +- 02 Jan 06 15:04 MST **RFC 822** +- 02 Jan 06 15:04 -0700 **with numeric zone** +- Mon, 02 Jan 2006 15:04:05 MST 27e95cb +- Mon, 02 Jan 2006 15:04:05 -0700 **with numeric zone** + +#### The following predefined date and timestamp format constants are also available + +- ANSIC = "Mon Jan _2 15:04:05 2006" +- UnixDate = "Mon Jan _2 15:04:05 MST 2006" +- RubyDate = "Mon Jan 02 15:04:05 -0700 2006" +- RFC822 = "02 Jan 06 15:04 MST" +- RFC822Z = "02 Jan 06 15:04 -0700" +- RFC850 = "Monday, 02-Jan-06 15:04:05 MST" +- RFC1123 = "Mon, 02 Jan 2006 15:04:05 MST" +- RFC1123Z = "Mon, 02 Jan 2006 15:04:05 -0700" +- RFC3339 = "2006-01-02T15:04:05Z07:00" +- RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00" +- Kitchen = "3:04PM" +// Useful time stamps. +- Stamp = "Jan _2 15:04:05" +- StampMilli = "Jan _2 15:04:05.000" +- StampMicro = "Jan _2 15:04:05.000000" +- StampNano = "Jan _2 15:04:05.000000000"