In
this article I am going to explain how to get number of days between two dates
in Sql server.
In
the previous article I have explained how to filter the record using Alphabetspager in asp.net, how to get comma separated values (data) from database andbind to checkboxlist in ASP.Net using C# and VB.net and how to Bind commaseparated values to listbox in asp.net.
Implementation:
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
Demo:
No comments:
Post a Comment