Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (20.3k points)

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





Is it possible to do in SQL Server?

1 Answer

0 votes
by (40.4k 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 

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 16, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer

Browse Categories