Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding months to date

Status
Not open for further replies.

www2004

Programmer
Aug 11, 2004
15
0
0
US
Newbie question:

How can I add, say, 2 months to a specific given date?

I appreciate any help!!!
 
Try to convert the number of months to actual number of days, then add to your initial date, then take away 1. for example, if your date is on A1 (i.e. 01JAN05) and your number of days is in B1 (i.e. 60), you could type this in c1:

=sum(a1+b1-c1)

Ensure that A1 and C1 are formatted as dates and that b1 is formatted as number.

Let me know if it works!
 
You must translate the date in the three bits that make a proper date: months, days and years. Then you can add the requested months:

Date( Month(date) + months to add; Day(date); Year(date) )

Then you're ready to show the result on the lay-out.

succes!

jaap
 
When using this:

Date( Month(date) + months to add; Day(date); Year(date) )

What if the date I'm starting with is 12/31/2004? Adding 2 to month would give 14. Now, even if I wrote some code to determine that the month would be 2, the ending date would be 2/31/2005.....this date does not exist.

Does Filemaker Pro not offer a function like DateAdd(...)?
 
qutoe: "What if the date I'm starting with is 12/31/2004? Adding 2 to month would give 14."

No, that is not a problem! I've made a little test program and it handles this situation properly.

jaap
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top