Datediff function
which day excluded datediff function, first day or last day? please consider following example.
select datediff(d,'01/13/2009', '05/13/2009')
it says 120 days. if count calendar, 121 days. sql datediff function skips 01/13/2009 or 05/13/2009?
thanks in advance.
hi chandramohan,
datediff returns number time boundries elapsed between given date range. example- 13 14 1 day completed. if count way 120 days between these 2 dates. further details... http://msdn.microsoft.com/en-us/library/aa258269(v=sql.80).aspx
you can cross check applying dateadd function, forward , backward e.g. dateadd(d,120,01/13/2009) , dateadd(d,-120,05/13/2009). both way gives 120 days difference.
hth,
cheers!!
ashish
please mark answered if answered question or mark helpful if helped solve problem.
SQL Server > Getting started with SQL Server
Comments
Post a Comment