Try these samples
SELECT DATEDIFF(m, "24 March 2001","24 March 1964")
SELECT DATEDIFF(yyyy, "24 March 2001","24 March 1964")
SELECT DATEDIFF(mi, "24 March 2001","24 March 1964")
SELECT DATEDIFF(wk, "24 March 2001","24 March 1964")
DATEDIFF (Transact-SQL)
DATEDIFF ( datepart , startdate , enddate )
You can use SQL Server DateDiff function to calculate difference between two dates. This delay can be calculated in days, months, years, minutes,hours or seconds.
Here is documentation from MSDN window.google_render_ad();
datepart
Is the parameter that specifies on which part of the date to calculate the difference. The following table lists dateparts and abbreviations recognized by SQL Server 2005. These dateparts and abbreviations cannot be supplied as a user-declared variable.
Thanks
Karthik
www.f5Debug.net
Gokul, if this helps please login to Mark As Answer. | Alert Moderator