Please note: If you find any post DOES NOT contain required amount of explanation, please do comment them with a request for more information. I will update as soon as I can attend to it. Also you can contact me with a link to the post.


Monday, February 09, 2009

DATEDIFF Function - TSQL - Microsoft SQL Server 2000/2005

Ex: DATEDIFF(yyyy, applicant.DateOfBirth, GETDATE()) = 28 [age of applicant in years]

datepart - Abbriviation
year - yy, yyyy
quarter - qq, q
month - mm, m
dayofyear - dy, y
day - dd, d
week - wk, ww
hour - hh
minute - mi, n
second - ss, s
millisecond - ms
microsecond - mcs
nanosecond - ns
 

Copyrights(C) - Charith Gunasekara 2005-2010