# 3.5.9.19 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 n, int n2])

## Parameters

d

is a Julian Date Value which can include Time

n

is a integer value, there are two options
 1 (default) Week starts on Sunday 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 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