Cldr.DateTime.Formatter.week_of_year

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

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

View Source

Specs

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

Returns the week of the year (symbol w) as an integer.

Arguments

Notes

Determining the week of the year is influenced by two factors:

  1. The calendar in use. For example the ISO calendar (which is the default calendar in Elixir) follows the ISO standard in which the first week of the year is the week containing the first thursday of the year.

  2. The territory in use. For example, in the US the first week of the year is the week containing January 1st whereas many territories follow the ISO standard.

Format Symbol

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

SymbolExampleCldr Format
w2, 22
ww02, 22

Examples

iex> import Cldr.Calendar.Sigils
Cldr.Calendar.Sigils
iex> Cldr.DateTime.Formatter.week_of_year ~D[2019-01-07], 1
"2"
iex> Cldr.DateTime.Formatter.week_of_year ~d[2019-W04-1], 2
"04"
Link to this function

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

View Source

Specs

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