dateformat

Enables formatting of birl Time records

TokenOutput
Hour of DayHH00 - 23
H0 - 23
hh01 - 12
h1 - 12
Minute of Hourmm00 - 59
m0 - 59
Second of Minutess00 - 59
s0 - 59
Fraction of SecondSSS000 - 999
SS00 - 99
S0 - 9
Period of DayAAM or PM
aam or pm
Time Zone/OffsetsZ-14:00 - +14:00
zEurope/London, US/Central, etc
Unix TimestampXUnix seconds
xUnix milliseconds
Day of Weekd0 - 6
do0th - 6th
ddSu - Sa
dddSun - Sat
ddddSunday - Saturday
Day of Week (ISO)E1 - 7
Day of MonthD1 - 31
Do1st - 31st
DD01 - 31
Day of YearDDD1 - 366
DDDo1st - 366th
DDDD001 - 366
Week of Year (ISO)W1 - 53
Wo1st - 53rd
WW01 - 53
MonthM1 - 12
Mo1st - 12th
MM01 - 12
MMMJan - Dec
MMMMJanuary - December
QuarterQ1 - 4
Qo1st - 4th
YearYY70 - 69
YYYY1970 - 2069

Other characters are just output as is Characters contained with […] will be output without formats

Functions

pub fn compile_format(
  fmt: String,
) -> Result(fn(Time) -> String, Nil)

Generates a function that can then be used to format given Time records Can return error if the format doesn’t parse successfully

pub fn format(fmt: String, time: Time) -> Result(String, Nil)

Formats the given Time using the specified format Can return error if the format doesn’t parse successfully

Search Document