Date/time template formatter, main format method is chrono.formatter.Formatter.format().
calendar determines which calendar to use for calculations, see chrono.calendar for a list.
Formats template by replacing substitution variables of the form $name or ${name} with formatted values based on the input date.
If any necessary values are missing (ie None) for a substitution variable, it will be replaced with an empty string.
Valid substitution variables:
Variable | Description |
---|---|
012hour | Hour, 12-hour, zero-padded |
0hour | Hour, zero-padded |
0day | Day, zero-padded |
0minute | Minute, zero-padded |
0month | Month, zero-padded |
0second | Second, zero-padded |
0week | Week, zero-padded |
0year | Year, zero-padded |
12hour | Hour, 12-hour |
ampm | AM/PM, based on hour |
day | Day |
hour | Hour |
minute | Minute |
month | Month |
monthname | Month name |
second | Second |
shortmonthname | Month name, abbreviated |
shortweekdayname | Weekday name, abbreviated |
shortyear | Year, two digits |
week | Week |
weekday | Weekday |
weekdayname | Weekday name |
year | Year |