Mega Code Archive

 
Categories / MSSQL Tutorial / Date Functions
 

Finding the Difference Between Two Dates

DATEDIFF subtracts the first date  from the second date. The syntax for DATEDIFF is: DATEDIFF ( datepart , startdate , enddate ) The first datepart code uses the same datepart codes as DATEADD. The second and third arguments are the date values that are part of the subtraction.