Timex.DateFormat.Formatters.StrftimeFormatter

Date formatting language defined by the strftime function from the Standard C Library.

This implementation in Elixir is mostly compatible with strftime. The exception is the absence of locale-depended results. All directives that imply textual result will produce English names and abbreviations.

A complete reference of the directives implemented here is given below.

Directive format

A directive is marked by the percent sign (%) followed by one character (<directive>). In addition, a few optional specifiers can be inserted in-between:

%<flag><width><modifier><directive>

Supported flags:

<width> is a non-negative decimal number specifying the minimum field width.

<modifier> can be E or O. These are locale-sensitive modifiers, and as such they are currently ignored by this implementation.

List of all directives

Years and centuries

Months

Days, and days of week

Weeks

Time

Time zones

Compound directives

Summary

format!(date, format_string)

Callback implementation for Timex.DateFormat.Formatters.Formatter.format!/2

format(date, format_string)

Callback implementation for Timex.DateFormat.Formatters.Formatter.format/2

tokenize(format_string)

Callback implementation for Timex.DateFormat.Formatters.Formatter.tokenize/1

Functions

format(date, format_string)

Specs:

  • format(%Timex.DateTime{calendar: term, day: term, hour: term, minute: term, month: term, ms: term, second: term, timezone: term, year: term}, String.t) :: {:ok, String.t} | {:error, term}

Callback implementation for Timex.DateFormat.Formatters.Formatter.format/2.

format!(date, format_string)

Specs:

  • format!(%Timex.DateTime{calendar: term, day: term, hour: term, minute: term, month: term, ms: term, second: term, timezone: term, year: term}, String.t) :: String.t | no_return

Callback implementation for Timex.DateFormat.Formatters.Formatter.format!/2.

tokenize(format_string)

Specs:

  • tokenize(String.t) :: {:ok, [%Timex.Parsers.DateFormat.Directive{format: term, len: term, match: term, max: term, min: term, optional: term, pad: term, pad_type: term, raw: term, token: term, type: term, validate: term}]} | {:error, term}

Callback implementation for Timex.DateFormat.Formatters.Formatter.tokenize/1.