January 15, 200818 yr Hi, I want to take a date recorded in a filed and add one month onto it. I have found one way that works by using the calculation: Day ( DD Start Date ) & "/" & Month ( DD Start Date ) + 1 & "/" & Year ( DD Start Date ) "DD Start Date" is the original field. This actually works which surprised me, but it fails when the next month is January i.e. the year has to increase by one. I assume there is an easier way to do this?
January 15, 200818 yr Author Ok actually found the answer, the code is: Date(Month(DD Start Date)+1; Day(DD Start Date); Year(DD Start Date))
August 21, 200817 yr You may need to use commas instead of semicolons, perhaps depending on FMPro version or your country. Edited August 21, 200817 yr by Guest
August 21, 200817 yr I thought, particularly now in vs. 9, that we ALL use semi-colons instead of some (like those from the US) needing to use comma. Do you mean that some countries still use commas?
August 17, 200916 yr Okay, what happens if the current month is December (i.e., 12). Is the calculation engine smart enough to roll-over to January (1) and increase the year by one? If so, how does one accomplish this, because it's not working for me. For Example, I'm using a Case statement to add to either the month, day, or year depending on what the user chooses from a pop-up. I have the following calculation for the field, but it doesn't seem to be working: Let ( d = Max ( Companies_Plants_Units_Devices_EVENTS::Date ) ; Case ( TestIntTimeID = 1 ; Date ( Month ( d ) ; Day ( d + TestInt ) ; Year ( d ) ) ; TestIntTimeID = 2 ; Date ( Month ( d ) ; Day ( d + ( TestInt * 7 ) ) ; Year ( d ) ) ; TestIntTimeID = 3 ; Date ( Month ( d + TestInt ) ; Day ( d ) ; Year ( d ) ) ; TestIntTimeID = 4 ; Date ( Month ( d ) ; Day ( d ) ; Year ( d + TestInt ) ) ; ) ) Where d is set to a specific date, TestIntTimeID is the ID from the pop-up menu (pertaining to a specific time interval), and TestInt is the amount of time to be added. In this situation, the following time intervals are available: +----+--------------+ | ID | TimeInterval | +----+--------------+ | 1 | Days | | 2 | Weeks | | 3 | Months | | 4 | Years | +----+--------------+ Thanks!
August 17, 200916 yr Nevermind. I see what I did wrong. I need to add the TestInt outside of the Day() or Month() or Year() function.
Create an account or sign in to comment