Week

week returns the day number (0 to 53) from a date.

Syntax

 week(DATE_EXPR)

Examples

 # What is the week number today?CURRENT_WEEK = week(date$)# What week was the "Bastille Day" ?TWENTY_NINE=day([14/07/1789]) : # returns 29

Description

week returns the week number of a valid date.

The type of result is Integer.

When the date is a null date ([0/0/0]), the function returns 0.

The weeks are numbered from 0 to 53. The calculation mode is the following:

This method corresponds to the ISO 8601 norm, except that week 0 does not exist in the norm (the last week number of the previous year is used). If the ISO value of week must be returned, the following formula should be used:
# Iso week for MY_DATEISO_WEEK=week(MY_DATE)+week(gdat$(31,12,year(MY_DATE)-1))*(week(MY_DATE)=0)

Associated errors

ErrorDescription
10The argument is not a date.
56The date is incorrect.

See also

month, year, month$, day, day$, eomonth, gdat$, dayn, nday, date$, datesyst, Date.