How to Get number of days between two dates in Asp.Net

Description:-

In this article I am going to explain how to get number of days between two dates in Sql server.
DATEDIFF() function of Sql server returns the number of days between two dates.

Syntax:-
Select DATEDIFF(day,startDate,endDate)

Example:-
declare @startDate datetime
declare @endDate datetime

set @startDate = '2016-03-15'
set @endDate = '2016-03-16'

select DATEDIFF(dd, @startDate, @endDate) as DayDiffrence 

Related Posts

Previous
Next Post »

1 comments:

comments

Thanks for comments.....