Skip to main content

Date.week_of_year

week_of_yearlocale

Documentation

Returns the number of week of year this date falls into. Produces a warning for a Date that is before epoch start.

Arguments

  • locale: the locale used to define the notion of weeks of year. If no locale is provided, then the ISO 8601 week of year is used.

Remarks

Locale Dependency

Note that this operation is locale-specific. It varies both by the local definition of the first day of week and the definition of the first week of year. For example, in the US, the first day of the week is Sunday and week 1 is the week containing January 1. In the UK on the other hand, the first day of the week is Monday, and week 1 is the week containing the first Thursday of the year. Therefore it is important to properly specify the locale argument.