Functions and operators : DIFF_WEEK( )

DIFF_WEEK( )

Calculates the number of weeks between two date values.

Syntax

DIFF_WEEK(date1, date2)

Arguments

date1

The first date or date expression to use in the calculation.

date2

The second date or date expression to use in the calculation.

Returns

The number of weeks between date1 and date2. The function calculates the difference by subtracting the week number of date1 from the week number of date2. For example, if date1 is 1/3/08 (week 1 of the year), and date2 is 1/7/08 (week 2 of the year), DIFF_WEEK( ) returns 1.

Example

The following example calculates the number of weeks between each value in the askByDate data field and each value in the shipByDate data field.

DIFF_WEEK([askByDate],[shipByDate])

The following example calculates the number of weeks from each value in the orderDate data field to the end of the year.

DIFF_WEEK([orderDate], "1/1/09")