Jed69 Posted January 15, 2008 Posted January 15, 2008 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?
Jed69 Posted January 15, 2008 Author Posted January 15, 2008 Ok actually found the answer, the code is: Date(Month(DD Start Date)+1; Day(DD Start Date); Year(DD Start Date))
r3ick Posted August 21, 2008 Posted August 21, 2008 (edited) You may need to use commas instead of semicolons, perhaps depending on FMPro version or your country. Edited August 21, 2008 by Guest
LaRetta Posted August 21, 2008 Posted August 21, 2008 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?
jgrunschel Posted August 17, 2009 Posted August 17, 2009 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!
jgrunschel Posted August 17, 2009 Posted August 17, 2009 Nevermind. I see what I did wrong. I need to add the TestInt outside of the Day() or Month() or Year() function.
Recommended Posts
This topic is 5636 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