Parse and Format Specifier #
The general form is %<modifier><width><alternate><specifier>, where <modifier>, <width>, and <alternate> are optional.
modifier #
glibc-style modifiers can be used before the specifier (here marked as z):
%-zno padding%_zpad with spaces%0zpad with zeros%^zconvert to upper case%#zconvert to lower case (consistently, unlike glibc)
width #
Width digits can also be used after any modifiers and before the specifier (here marked as z), for example:
%4zpad to 4 characters (with default padding character)%_12zpad with spaces to 12 characters
alternate #
An optional E character indicates an alternate formatting. Currently this only affects %Z and %z.
%Ezalternate formatting
specifier #
%%%%ttab%nnewline
- z : Specifier
timezone offset in the format
±HHMM - Ez : Specifier
timezone offset in the format
±HH: MM - Z : Specifier
timezone name (or else offset in the format
±HHMM) - EZ : Specifier
timezone name (or else offset in the format
±HH: MM) - P : Specifier
day-half of day from (
amPmlocale), converted to lowercase,am,pm - p : Specifier
day-half of day from (
amPmlocale),AM,PM - H : Specifier
hour of day (24-hour), 0-padded to two chars,
00-23 - k : Specifier
hour of day (24-hour), space-padded to two chars,
0-23 - I : Specifier
hour of day-half (12-hour), 0-padded to two chars,
01-12 - l : Specifier
hour of day-half (12-hour), space-padded to two chars,
1-12 - M : Specifier
minute of hour, 0-padded to two chars,
00-59 - S : Specifier
second of minute (without decimal part), 0-padded to two chars,
00-60 - q : Specifier
picosecond of second, 0-padded to twelve chars,
000000000000-999999999999. - Q : Specifier
decimal point and fraction of second, up to 12 second decimals, without trailing zeros. For a whole number of seconds,
%Qomits the decimal point unless padding is specified. - u : Specifier
day of week number for Week Date format,
1(= Monday) -7(= Sunday) - w : Specifier
day of week number,
0(= Sunday) -6(= Saturday) - a : Specifier
day of week, short form (
sndfromTime.TimeLocale.wDayslocale),Sun-Sat - A : Specifier
day of week, long form (
fstfromTime.TimeLocale.wDayslocale),Sunday-Saturday - Y : Specifier
year, no padding. Note
%0Yand%_Ypad to four chars - G : Specifier
year, no padding. Note
%0Yand%_Ypad to four chars - y : Specifier
year of century, 0-padded to two chars,
00-99 - g : Specifier
year of century, 0-padded to two chars,
00-99 - C : Specifier
century, no padding. Note
%0Cand%_Cpad to two chars - B : Specifier
month name, long form (
fstfromTime.TimeLocale.monthslocale),January-December - b : Specifier
month name, short form (
sndfromTime.TimeLocale.monthslocale),Jan-Dec - m : Specifier
month of year, 0-padded to two chars,
01-12 - d : Specifier
day of month, 0-padded to two chars,
01-31 - e : Specifier
day of month, space-padded to two chars,
1-31 - j : Specifier
day of year, 0-padded to three chars,
001-366 - f : Specifier
century for Week Date format, no padding. Note
%0fand%_fpad to two chars - V : Specifier
week of year for Week Date format, 0-padded to two chars,
01-53 - U : Specifier
week of year where weeks start on Sunday (as
sundayStartWeek), 0-padded to two chars,00-53 - W : Specifier
week of year where weeks start on Monday (as
mondayStartWeek), 0-padded to two chars,00-53
Instances For
Equations
- Time.instReprSpecifier = { reprPrec := Time.reprSpecifier✝ }
Equations
- Time.instBEqSpecifier = { beq := Time.beqSpecifier✝ }
- c : SubstituteSpecifier
as 'dateTimeFmt' of
Time.TimeLocale - R : SubstituteSpecifier
same as
%H:%M - T : SubstituteSpecifier
same as
%H:%M:%S - X : SubstituteSpecifier
as
timeFmtofTime.TimeLocale(e.g.%H:%M:%S) - r : SubstituteSpecifier
as
time12FmtofTime.TimeLocale(e.g.%I:%M:%S %p) - D : SubstituteSpecifier
same as
%m\/%d\/%y - F : SubstituteSpecifier
same as
%Y-%m-%d - x : SubstituteSpecifier
as
dateFmtofTime.TimeLocale(e.g.%m\/%d\/%y) - h : SubstituteSpecifier
month name, short form
Instances For
Equations
- Time.toSpecifier 'C' = some Time.Specifier.C
- Time.toSpecifier 'f' = some Time.Specifier.f
- Time.toSpecifier 'Y' = some Time.Specifier.Y
- Time.toSpecifier 'G' = some Time.Specifier.G
- Time.toSpecifier 'y' = some Time.Specifier.y
- Time.toSpecifier 'g' = some Time.Specifier.g
- Time.toSpecifier 'B' = some Time.Specifier.B
- Time.toSpecifier 'b' = some Time.Specifier.b
- Time.toSpecifier 'm' = some Time.Specifier.m
- Time.toSpecifier 'd' = some Time.Specifier.d
- Time.toSpecifier 'e' = some Time.Specifier.e
- Time.toSpecifier 'V' = some Time.Specifier.V
- Time.toSpecifier 'U' = some Time.Specifier.U
- Time.toSpecifier 'W' = some Time.Specifier.W
- Time.toSpecifier 'u' = some Time.Specifier.u
- Time.toSpecifier 'A' = some Time.Specifier.A
- Time.toSpecifier 'a' = some Time.Specifier.a
- Time.toSpecifier 'w' = some Time.Specifier.w
- Time.toSpecifier 'j' = some Time.Specifier.j
- Time.toSpecifier 'H' = some Time.Specifier.H
- Time.toSpecifier 'M' = some Time.Specifier.M
- Time.toSpecifier 'S' = some Time.Specifier.S
- Time.toSpecifier 'q' = some Time.Specifier.q
- Time.toSpecifier 'Q' = some Time.Specifier.Q
- Time.toSpecifier 'z' = some Time.Specifier.z
- Time.toSpecifier x✝ = none
Instances For
Equations
- Time.toSubstituteSpecifier 'c' = some Time.SubstituteSpecifier.c
- Time.toSubstituteSpecifier 'R' = some Time.SubstituteSpecifier.R
- Time.toSubstituteSpecifier 'T' = some Time.SubstituteSpecifier.T
- Time.toSubstituteSpecifier 'X' = some Time.SubstituteSpecifier.X
- Time.toSubstituteSpecifier 'r' = some Time.SubstituteSpecifier.r
- Time.toSubstituteSpecifier 'D' = some Time.SubstituteSpecifier.D
- Time.toSubstituteSpecifier 'F' = some Time.SubstituteSpecifier.F
- Time.toSubstituteSpecifier 'x' = some Time.SubstituteSpecifier.x
- Time.toSubstituteSpecifier 'h' = some Time.SubstituteSpecifier.h
- Time.toSubstituteSpecifier x✝ = none