Cldr.DateTime.Formatter.year

You're seeing just the function year, go back to Cldr.DateTime.Formatter module for more information.
Link to this function

year(year, n \\ 1, options \\ [])

View Source

Specs

year(Calendar.date(), integer(), Keyword.t()) ::
  String.t() | {:error, String.t()}

Returns the year (format symbol y) of a date as an integer. The y format returns the year as a simple integer in string format.

The format yy is a special case which requests just the two low-order digits of the year, zero-padded as necessary. For most use cases, y or yy should be adequate.

Arguments

Format Symbol

The representation of the quarter is made in accordance with the following table:

SymbolExampleCldr Format
y7Minimum necessary digits
yy"17"Least significant 2 digits
yyy"017", "2017"Padded to at least 3 digits
yyyy"2017"Padded to at least 4 digits
yyyyy"02017"Padded to at least 5 digits

In most cases the length of the y field specifies the minimum number of digits to display, zero-padded as necessary; more digits will be displayed if needed to show the full year.

Examples

iex> Cldr.DateTime.Formatter.year %{year: 2017, calendar: Calendar.ISO}, 1
2017

iex> Cldr.DateTime.Formatter.year %{year: 2017, calendar: Calendar.ISO}, 2
"17"

iex> Cldr.DateTime.Formatter.year %{year: 2017, calendar: Calendar.ISO}, 3
"2017"

iex> Cldr.DateTime.Formatter.year %{year: 2017, calendar: Calendar.ISO}, 4
"2017"

iex> Cldr.DateTime.Formatter.year %{year: 2017, calendar: Calendar.ISO}, 5
"02017"
Link to this function

year(date, n, locale, backend, options \\ [])

View Source

Specs

year(Calendar.date(), integer(), locale(), Cldr.backend(), Keyword.t()) ::
  String.t() | {:error, String.t()}