vasilek Posted May 17, 2004 Posted May 17, 2004 Hello. What is the way to add month(s) and year(s) to a date. For example: - Add 1 month to a date 5/17/2004; - Add 3 months to a date 5/17/2004; - Add 6 months to a date 5/17/2004; - Add 1 year to a date 5/17/2004; - Add 2 years to a date 5/17/2004; - Add 3 years to a date 5/17/2004. I am adding a number of days (5/17/2004 + 180 (6 months)), but the new date is slightly off by several days beacause of the obvious reason. Thank you in advance for help on this one.
-Queue- Posted May 17, 2004 Posted May 17, 2004 Date( Month( field ) + A, Day( field ), Year( field ) + B ) where A is the number of months to add and B the number of years to add.
Fenton Posted May 17, 2004 Posted May 17, 2004 Look at the Date() function. Date ( month, day, year) -Add 1 month to a "Date_" field. Date ( Month(Date_) + 1, Day(Date_), Year(Date_) ) - Add 1 year. Date ( Month(Date_), Day(Date_), Year(Date_) +1 ) It's smart about such things as advancing the year automatically when adding days or months, dealing with leap years, etc..
Recommended Posts
This topic is 7571 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now