DATEDIFF (Report Builder)
Returns the difference between the Start datetime and the End datetime.
Syntax
DATEDIFF(interval, datetime, datetime)
interval |
Specifies the units (year, quarter, month, day, hour, minute, second or week) used to calculate the date difference. |
datetime |
Specifies the start date. |
datetime |
Specifies the end date. |
Remarks
- Intervals are not case-sensitive.
The following intervals are valid.
Interval | Results |
---|---|
YEAR |
Returns the number of years between the start and end date values. |
QUARTER |
Returns the number of quarters between the start and end date values. |
MONTH |
Returns the number of months between the start and end date values. |
WEEK |
Returns the number of weeks between the start and end date values. |
DAY |
Returns the number of days between the start and end date values. |
HOUR |
Returns the number of hours between the start and end date values. |
MINUTE |
Returns the number of minutes between the start and end date values. |
SECOND |
Returns the number of seconds between the start and end date values. |
Example
Formula | Result |
---|---|
DATEDIFF(MONTH, #1/1/2009#, #3/31/2009#) |
2 |
DATEDIFF(DAY, Sell Start Date, Sell End Date) |
Returns the number of days difference for each instance of the Sell Start Date and Sell End Date fields. |
See Also
Concepts
Working with Formulas (Report Builder)
Using Functions (Report Builder)
Date and Time Functions (Report Builder)
Report Builder How-to Topics
Working with Literals in Formulas and Filters (Report Builder)
Formatting Numerical Data (Report Builder)
Help and Information
Getting SQL Server 2005 Assistance
Change History
Release | History |
---|---|
12 December 2006 |
|
14 April 2006 |
|