all groups > sql server programming > june 2007 >
You're in the

sql server programming

group:

query to subtract 2 dates to get no. of days?


query to subtract 2 dates to get no. of days? Hassan
6/20/2007 9:12:30 PM
sql server programming:
If i want to get the number of days between 2 dates, how do I do so ?

For eg: how many days is it between 5/1/2007 and 6/15/2007 ?

Thanks

Re: query to subtract 2 dates to get no. of days? vt
6/21/2007 12:00:00 AM
Hi

use Datadiff function.see BOL for more info

Regards
VT
Knowledge is power, share it....
http://oneplace4sql.blogspot.com/
[quoted text, click to view]

Re: query to subtract 2 dates to get no. of days? Tom Cooper
6/21/2007 12:18:26 AM
Select DateDiff(d, '2007/5/1', '2007/6/15')

Tom

[quoted text, click to view]

Re: query to subtract 2 dates to get no. of days? Uri Dimant
6/21/2007 7:17:22 AM
Hassan
1) Using Calendar table
2) Take a look at DATEDIFF function in the BOL


[quoted text, click to view]

AddThis Social Bookmark Button