defmodule Timex.Format.DateTime.Formatters.Default do @moduledoc """ Date formatting language used by default by the formatting functions in Timex. This is a novel formatting language introduced with `DateFormat`. Its main advantage is simplicity and usage of mnemonics that are easy to memorize. ## Directive format A directive is an optional _padding specifier_ followed by a _mnemonic_, all enclosed in braces (`{` and `}`): {} Supported padding specifiers: * `0` -- pads the number with zeros. Applicable to mnemonics that produce numerical result. * `_` -- pads the number with spaces. Applicable to mnemonics that produce numerical result. When padding specifier is omitted, numbers will not be padded. ## List of all directives ### Years and centuries * `{YYYY}` - full year number (0..9999) * `{YY}` - the last two digits of the year number (0.99) * `{C}` - century number (0..99) * `{WYYYY}` - year number (4 digits) corresponding to the date's ISO week (0000..9999) * `{WYY}` - year number (2 digits) corresponding to the date's ISO week (00.99) ### Months * `{M}` - month number (1..12) * `{Mshort}` - abbreviated month name (Jan..Dec, no padding) * `{Mfull}` - full month name (January..December, no padding) ### Days and weekdays * `{D}` - day number (1..31) * `{Dord}` - ordinal day of the year (1..366) * `{WDmon}` - weekday, Monday first (1..7, no padding) * `{WDsun}` - weekday, Sunday first (0..6, no padding) * `{WDshort}` - abbreviated weekday name (Mon..Sun, no padding) * `{WDfull}` - full weekday name (Monday..Sunday, no padding) ### Weeks * `{Wiso}` - ISO week number (01..53) * `{Wmon}` - week number of the year, Monday first (01..53) * `{Wsun}` - week number of the year, Sunday first (01..53) ### Time * `{h24}` - hour of the day (00..23) * `{h12}` - hour of the day (1..12) * `{m}` - minutes of the hour (00..59) * `{s}` - seconds of the minute (00..60) * `{ss}` - fractional second, based on precision of microseconds given (.xxx == ms, .xxxxxx == us) * `{s-epoch}` - number of seconds since UNIX epoch * `{am}` - lowercase am or pm (no padding) * `{AM}` - uppercase AM or PM (no padding) ### Time zones * `{Zname}` - time zone name, e.g. `UTC` (no padding) * `{Zabbr}` - time zone abbreviation, e.g. `CST` (no padding) * `{Z}` - time zone offset in the form `+0230` (no padding) * `{Z:}` - time zone offset in the form `-07:30` (no padding) * `{Z::}` - time zone offset in the form `-07:30:00` (no padding) ### Compound directives These are shortcut directives corresponding to parts of the ISO 8601 specification. The benefit of using these over manually constructed ISO formats is that these directives convert the date to UTC for you. * `{ISO:Basic}` - `T