dateformat
Enables formatting of birl Time records
Token | Output | |
---|---|---|
Hour of Day | HH | 00 - 23 |
H | 0 - 23 | |
hh | 01 - 12 | |
h | 1 - 12 | |
Minute of Hour | mm | 00 - 59 |
m | 0 - 59 | |
Second of Minute | ss | 00 - 59 |
s | 0 - 59 | |
Fraction of Second | SSS | 000 - 999 |
SS | 00 - 99 | |
S | 0 - 9 | |
Period of Day | A | AM or PM |
a | am or pm | |
Time Zone/Offsets | Z | -14:00 - +14:00 |
z | Europe/London, US/Central, etc | |
Unix Timestamp | X | Unix seconds |
x | Unix milliseconds | |
Day of Week | d | 0 - 6 |
do | 0th - 6th | |
dd | Su - Sa | |
ddd | Sun - Sat | |
dddd | Sunday - Saturday | |
Day of Week (ISO) | E | 1 - 7 |
Day of Month | D | 1 - 31 |
Do | 1st - 31st | |
DD | 01 - 31 | |
Day of Year | DDD | 1 - 366 |
DDDo | 1st - 366th | |
DDDD | 001 - 366 | |
Week of Year (ISO) | W | 1 - 53 |
Wo | 1st - 53rd | |
WW | 01 - 53 | |
Month | M | 1 - 12 |
Mo | 1st - 12th | |
MM | 01 - 12 | |
MMM | Jan - Dec | |
MMMM | January - December | |
Quarter | Q | 1 - 4 |
Qo | 1st - 4th | |
Year | YY | 70 - 69 |
YYYY | 1970 - 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