Month difference

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
Hello Friends

Could anyone please tell how to calculate number of months' difference between today and some other date in SQL (on MS Access)?

The date column has date in the format as shown here "2008-01-23 22:51:52". I need to calculate number of months between Today and this date.

Any ideas?

Thanks
Rajesh
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hello Friends

I think I got this. I used following in my SELECT statement and it is working:

DateDiff("m", [General AttributesDate Created], Date())

[General AttributesDate Created] is the column name that has date to compare with current date.

Thanks
Rajesh
 
Upvote 0
You need to check for the end of each month.
I guess it will be the same as in Excel but DATEDIF will give an answer of '0' for the difference between 31st March and 30th April, whereas you may want to treat that as one calendar month.
You may therefore have to create a User Defined Function (UDF) to calculate that for you.
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,537
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top