DateDiff( datepart, date_time_1, date_time_2 )
Returns the difference between two date/time values (date_time_2 – date_time_1) expressed in the specified datepart unit.
Example
select DateDiff( day, ‘2012-02-01’, ‘2012-03-01’ )
Differences
MS SQL Server does not support the dateparts CalWeekOfYear
, CalDayOfWeek
and CalYearOfWeek
.
In ASE, if you use the datepart weekday with DateDiff
, the number of full weeks is counted. In MS SQL Server, the number of days is counted.