Skip to main content

Time

Whatโ€‹

Show the current timestamp.

Sample Configurationโ€‹

{
"type": "time",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"time_format": "15:04:05"
}
}

Propertiesโ€‹

NameTypeDescription
time_formatstringformat to use, follows the golang standard - defaults to 15:04:05

Template (info)โ€‹

default template
{{ .CurrentDate | date .Format }}

Propertiesโ€‹

NameTypeDescription
.FormatstringThe time format (set via time_format)
.CurrentDatetimeThe time to display (testing purpose)

Syntaxโ€‹

  • 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

Formatsโ€‹

The following predefined date and timestamp format constants are also available:

NameOutput
ANSICMon Jan 2 15:04:05 2006
UnixDateMon Jan 2 15:04:05 MST 2006
RubyDateMon Jan 02 15:04:05 -0700 2006
RFC82202 Jan 06 15:04 MST
RFC822Z02 Jan 06 15:04 -0700
RFC850Monday, 02-Jan-06 15:04:05 MST
RFC1123Mon, 02 Jan 2006 15:04:05 MST
RFC1123ZMon, 02 Jan 2006 15:04:05 -0700
RFC33392006-01-02T15:04:05Z07:00
RFC3339Nano2006-01-02T15:04:05.999999999Z07:00
Kitchen3:04PM
StampJan 2 15:04:05
StampMilliJan 2 15:04:05.000
StampMicroJan 2 15:04:05.000000
StampNanoJan 2 15:04:05.000000000

Examplesโ€‹

To display the time in multiple time zones, using Sprig's Date Functions:

{{ .CurrentDate | date .Format }} {{ dateInZone "15:04Z" .CurrentDate "UTC" }}