Hinweis:Dieser Abschnitt ist nur in englischer Sprache verfügbar. Wir bitten um Ihr Verständnis.
3.5.9.20 WeekNum
Description
Returns a number that indicates where the week falls numerically within a year. We assume that the week containing January 1st is the first week of the year.
See this note.
Syntax
double WeekNum(double d[, int n1, int n2])
Parameters
d
- is a Julian Date Value which can include Time
n1
- is a integer value, there are two options
| 1 (default) | Week starts on Sunday |
|---|---|
| 2 | Week starts on Monday |
n2(2025)
- decides which week is the first week of the year
| 1 (default) | Week containing January 1 is the first week of the year |
|---|---|
| 2 | Week that has at least four days in the new year (complies with ISO standard 8601, section 3.17) is the first week of the year |
Return
If it is a Julian days date, return the calendar week number of the year, 1 to 53.
If it is not a Julian days date, return -1/(2025)missing value.
Example
int rr=weeknum(date(1/11/2009)); rr= ; // Should return where the week falls numerically within a year, 3.
int rr=weeknum(2454842,2); rr=; // Should return where the week falls numerically within a year, 2.
//January 1, 2022 is on Saturday WeekNum(date(1/1/2022),1,1)=;//return 1 WeekNum(date(1/1/2022),1,2)=;//return 52