0 votes
1 view
in SQL by (22.4k points)

I'm trying to get the total number of days between two days:

1/1/2011

3/1/2011

RETURN

62

Is it possible to do in SQL Server?

1 Answer

0 votes
by (40.3k points)

Try this:

PRINT DATEDIFF(DAY, '1/1/2011', '3/1/2011') 

This will give you the number of times the midnight boundary is crossed between the two dates.

You can decide to add one to this if you're including both dates in the count - or subtract one if you don't want to include either date.s 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...