Xbasic
WEEK Function
Syntax
Week_Number as N = week(Date_Value as D)
Arguments
- Date_ValueDate
The date used to determine the calendar week of the year.
Returns
- Week_NumberNumeric
Returns an integer equal to the week number (1-53) for the specified Date_Value.
Description
Get the calendar week number of a date where Sunday is the first day of the week.
Discussion
The WEEK() function returns the integer equal to the week number (1-53) for the specified Date_Value. Every week starts on Sunday. A week includes any number of days in the year. For example, if January 1 is on a Saturday, it is in week 1. January 2 (a Sunday) would be in week 2.
Example
The following example is from the Interactive Window in Alpha Anywhere.
dim start as D = {1/1/2005} ? week(start) = 1 dim date as D date = ctod("12/27/04") ? date = {12/27/2004} ? week(date) = 53
See Also