Week Function

Description

Returns the week (1-53) of the year, where the first week of the year is assumed to begin on the first occurrence of a designated weekday. For example, you might designate that the first week of the year should begin on the first Monday of the year.

Syntax

Week(date[,startday])

Arguments

date may be any valid date in the range 1/1/1601-12/31/2400.

startday is an optional argument that designates the day that begins each week and may be in the range 1 (representing Sunday) to 7 (representing Saturday). Week #1 of each year is assumed to begin on the first occurrence of the designated day. Any date that falls earlier in the year is assigned to week #0.

Note: If startday is omitted, the first week of the year (and every week thereafter), is assumed to begin on whichever weekday falls on the first day of that year (whether it be a Sunday, a Monday, a Tuesday, etc). In this case, the Week function returns a week number based on the equivalent formula Int(Juliandate/7).

Return value

This function returns a number in the range 1-53.

Calculated field example

If you were reading this help message on March 21, 2007, the following function would return the value 12, indicating that March 21 falls within the 12th week of the year 2007: Week(Today())

Filter/Find example

Records representing shipments during the first four weeks of the year 2006 can be selected or found using the expression: Year(Ship_date)=2006.And.Week(Ship_date)<=4