WEEKNUM ER function

The WEEKNUM function returns an Integer value that represents the week of the year that includes a specified Date value. The calculation is based on culture-dependent rules that define a calendar week and the first day of the week.

Syntax

WEEKNUM (date, culture) as Integer

Arguments

date: Date

A date value that represents the date to use to calculate the week of the year.

culture: String

The culture to use for the calculation. You can use culture codes that are supported in accordance with .NET standards.

Return values

Integer

The resulting numeric value.

Usage notes

The week of the year is calculated based on the ISO 8601 standard, if this standard has been adopted by a country or region that the locale is provided for at runtime. Otherwise, the calculation is based on country/region-specific national standards.

If an unsupported culture code is provided as an argument of the WEEKNUM function at runtime, an exception is thrown. If the blank string is provided as a culture code, the English country/region-neutral calendar is used to calculate the week number.

Examples

WEEKNUM (DATEVALUE ("01-01-2020", "de")) returns 1.

WEEKNUM (DATEVALUE ("01-01-2021", "de")) returns 53.

WEEKNUM (DATEVALUE ("01-01-2022", "de")) returns 52.

WEEKNUM (DATEVALUE ("01-01-2022", "ar")) returns 21.

Additional resources

Date and time functions