Find The Month Deference Between Two Dates – Query Examples

Find The Month Deference Between Two Dates

To Find month difference between two dates, we must use the datediff function. With DateDifference function we can get all kinds of date types. The datediff function gets three parameters.
First Parameter: Date interval type. For month, we must write “MM” or “MONTH” statements
Second Parameter: Small Date
Third Parameter: Older Date

Example Queries

EX 1) Calculate the day count between ‘09.05.2018’ and ‘10.05.2018’ dates;

Result: 1

Important Note: The result changes by the language of the sql server. To change sql server’s language type the code below;

New Result: 0-> Because in Turkish dateformat is day/month/Year in English Date Format is Month/Day/Year

EX 2) Calculate the month count between ‘09.05.2018’ and today; (English Format)

Result: 6 ->This Date: March 23,2019

EX3) Calculate the month count between student’s birthdate and today;

505 rows are listed

About the author

Thomas Brown

Leave a Comment

%d bloggers like this: