Home / Search/ Language Reference/ Functions/ Scalar Functions/ DateTime Functions/week_of_year

week_of_year

The week_of_year function returns an integer representing the week number. The week number is calculated from the first week of a year, which is the one that includes the first Thursday, according to ISO 8601.

Syntax

    week_of_year( Datetime )

Arguments

Returns

The week number of the given year.

Examples

  • week_of_year(datetime(2020-12-31)) returns as 53
  • week_of_year(datetime(1970-01-01)) returns as 1