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

This example returns 53:

print week_of_year( datetime(2020-12-31) )

This example returns 1:

print week_of_year( datetime(1970-01-01) )