### ddiff()

#### Syntax

**ddiff**(datepart,date1,date2)

#### Description

Returns the difference between two dates, *date1* and *date2*, in the units specified by a *datepart* constant; the specified dates are included in the evaluation.

When you specify one of the day of the week constants (kSunday thru kSaturday) as the *datepart* argument, you get the number of occurrences of that day between the two dates. When you specify kYear,kQuarter, kMonth, or kWeek as the *datepart* argument, the function counts the end of years, quarters, months, or weeks between the two dates.

The datepart constants that you can use are: kYear, kMonth, kWeek, kQuarter, kDay, kSunday thru kSaturday, kHour, kMinute, kSecond, kCentiSecond.

#### Example

###### Calculate lDiff as **ddiff**(kMonth,"1/31/03","3/1/03")

###### ; returns 2

Calculate lDiff as **ddiff**(kDay,"4/8/03",#D)

###### ; returns 30, the number of days between the two dates, assume #D is May 8, 2003