Monday, 2 July 2012

SQL DATEDIFF() function

SQL DATEDIFF() Function

The DATEDIFF() function returns the time between two dates.

Example:-

DATEDIFF(datepart,startdate,enddate)

We can use DATEDIFF function

SELECT DATEDIFF(day,'2012-07-02','2012-08-01') AS DiffDate

We get the number of days between two dates... 

No comments:

Post a Comment