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

 int WeekNum(double d, int n)

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
2 Week starts on Monday

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.

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.

See Also

WeekDay, Year, Month, Day, Hour, Minute, Second, Now,