How count Difference Between Two date Using DatedIff
MS Sql Server
The DATEDIFF() function returns the difference between two date values, based on the interval specified.
Queries & Examples
1.Diiference Between Years
SELECT DATEDIFF(year, '2011/08/25','2017/08/25') AS Years;
It give use Result Of Difference of year
-----------------------------------------------------
2.Diiference Between Month
SELECT DATEDIFF(MONTH, '2011/08/25','2017/08/25') AS Months;
----------------------------------------------------
3.Diiference Between Weeks
SELECT DATEDIFF(WEEK, '2011/08/25','2017/08/25') AS Weeks;
----------------------------------------------------
4.Diiference Between Days
SELECT DATEDIFF(DAY, '2011/08/25','2017/08/25') AS Days;
----------------------------------------------------
5.Diiference Between Minutes
SELECT DATEDIFF(MINUTE, '2011/08/25','2017/08/25') AS Minutes;
The DATEDIFF() function returns the difference between two date values, based on the interval specified.
Queries & Examples
1.Diiference Between Years
SELECT DATEDIFF(year, '2011/08/25','2017/08/25') AS Years;
It give use Result Of Difference of year
-----------------------------------------------------
2.Diiference Between Month
SELECT DATEDIFF(MONTH, '2011/08/25','2017/08/25') AS Months;
----------------------------------------------------
3.Diiference Between Weeks
SELECT DATEDIFF(WEEK, '2011/08/25','2017/08/25') AS Weeks;
----------------------------------------------------
4.Diiference Between Days
SELECT DATEDIFF(DAY, '2011/08/25','2017/08/25') AS Days;
----------------------------------------------------
5.Diiference Between Minutes
SELECT DATEDIFF(MINUTE, '2011/08/25','2017/08/25') AS Minutes;
Share This with your friend by choosing any social account
You may also read following recent Post
![]() |
Types Of database
700 By Rizwan Saqib |
![]() |
History Of DataBase
716 By Rizwan Saqib |