View Source Mobilizon.Cldr.DateTime.Formatter (Mobilizon v4.1.0-alpha.1)

Implements the compilation and execution of date, time and datetime formats.

Summary

Functions

Returns the formatted and localised date, time or datetime for a given Date, Time, DateTime or struct with the appropriate fields.

Functions

Link to this function

format(date, format, locale \\ Cldr.get_locale(), options \\ [])

View Source
@spec format(
  Calendar.date() | Calendar.time() | Calendar.datetime(),
  String.t(),
  Cldr.Locale.locale_reference(),
  Keyword.t()
) :: {:ok, String.t()} | {:error, {module(), String.t()}}

Returns the formatted and localised date, time or datetime for a given Date, Time, DateTime or struct with the appropriate fields.

Arguments

Options

NOTE This function is called by Cldr.Date.to_string/2, Cldr.Time.to_string/2 and Cldr.DateTime.to_string/2 which is the preferred API.

Examples

iex> Mobilizon.Cldr.DateTime.Formatter.format ~U[2017-09-03 10:23:00.0Z], "yy/MM/dd hh:MM", "en"
{:ok, "17/09/03 10:09"}
Link to this function

gmt_tz_format(locale, offset, options \\ [])

View Source