DIFF_QUARTER( )
Calculates the number of quarters between two date values.
Syntax
DIFF_QUARTER(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 quarters between date1 and date2. DIFF_QUARTER calculates the difference by subtracting the quarter number of the month in date1 from the quarter number of the month in date2. The first quarter consists of the first three months in a calendar year, the second quarter consists of the next three months, and so on. For example, if date1 is 8/1/08 and date2 is 10/31/08, DIFF_QUARTER( ) returns 1. If date1 is 7/25/08 and date2 is 09/5/08, DIFF_QUARTER( ) returns 0.
Example
The following example calculates the number of quarters between each value in the PlanClosing data field and each value in the ActualClosing data field:
DIFF_QUARTER([PlanClosing],[ActualClosing])
The following example calculates the number of quarters from each value in the orderDate data field to the end of the year:
DIFF_QUARTER([orderDate], "1/1/09")