Difference Between Dates Sql. Last two digits are the number of days. You can also use these to calculate age.
If you change the start and end dates to 12312004 and 01012009 respectively. SQL Structured Query Language sql The DATEDIFF function accepts three arguments. Third and fourth digits from the end are the number of months.
In this tutorial we are focus on DateDiff function of SQL Server which takes in three parameters.
Simply subtract them using a minus sign -. The value in the second row of the results shows that the difference is 7 months and 29 days. The statement DATEDIFFwkfromdatetodate gives the number of weeks between dates and 2 gives us the weekend Saturday and Sunday count. Swapping the dates would result in a negative result.
