Derives the numeric value for the week within the year (1, 2, etc.). Input must be the output of the DATE function or a reference to a column containing Datetime values. The output of this function increments on Sunday.

Week 1 of the year is the week that contains January 1.

NOTE: If the source Datetime value does not include a valid input for this function, a missing value is returned.

NOTE: Depending on the locale where the calculation of this function is performed, the maximum number of weeks in a year may be 52 or 53. It's possible that you could see different results in your browser, , and other running environments due to locale. For more information, seeĀ Locale Settings.

Column reference example:

weeknum(MyDate)

Output: Returns the numeric week number values derived from the MyDate column.

weeknum(datetime_col)


ArgumentRequired?Data TypeDescription
datetime_colYdatetimeName of column whose week number values are to be computed

datetime_col

Name of the column whose week number value is to be computed.

Tip: You cannot insert constant Datetime values as inputs to this function. However, you can use the following: WEEKNUM(DATE(2017,12,20)) .

Required?Data TypeExample Value
YesDatetimemyDate

Example - Day of Date functions