Week
week
returns the day number (0 to 53) from a date.
Syntax
week(DATE_EXPR)
DATE_EXPR
is an expression returning a date.
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:
- A week starts on Monday (day 1) and ends on Sunday (day 7).
- The first week of the year is the week that contains the first Thurday of the year. If the first day of the year is Friday, Saturday, or Sunday, a week numbered 0 exists from first of January until the first Sunday.
# Iso week for MY_DATE
ISO_WEEK=week(MY_DATE)+week(gdat$(31,12,year(MY_DATE)-1))*(week(MY_DATE)=0)
Associated errors
Error | Description |
---|---|
10 | The argument is not a date. |
56 | The date is incorrect. |
See also
month, year, month$, day, day$, eomonth, gdat$, dayn, nday, date$, datesyst, Date.