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​

NameTypeDefaultDescription
time_formatstring15:04:05Format to use

Template (info)​

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

Properties​

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

Syntax​

Formats​

Follows the golang datetime standard:

DateTimeFormat
Year06, 2006
Month01, 1, Jan, January
Day02, 2, _2 (width two, right justified)
WeekdayMon, Monday
Hours03, 3, 15
Minutes04, 4
Seconds05, 5
ms Ξs ns.000, .000000, .000000000
ms Ξs ns (trailing zeros removed).999, .999999, .999999999
am/pmPM, pm
TimezoneMST
Offset-0700, -07, -07:00, Z0700, Z07:00

Predefined formats​

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

NameFormat
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" }}