Adding Months (or years) to a date field - InfoPath Dev
in

InfoPath Dev

Adding Months (or years) to a date field

Last post 04-11-2009 04:44 PM by lukeksmith. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-11-2007 01:59 PM

    Adding Months (or years) to a date field

    Hi,I'm loosing the plot somewhat over this.  Somewhere I've seen guidance which states how a date field can have its value increased by a number of months. 

    Basically I want to have two fields - a date field and a 'months' field, and once entries have been made in those, either when a 'Save' button is pressed or a refresh occurs on the form, for the new calculated date to appear in a new 'read only' field. 

    Unfortunately the approach of converting months into days (3 months would equate to approx. 91 days for example) and then adding that to the date field, isn't really good enough in this situation as I'm wanting to ensure we have the same date in the month regardless. 

    It's for use around reminders for payment dates and terms and so it has to be exact, therefore for example if we have a start date of 2nd Februay, and that should have 5 months added to it, it is essential that this becomes 2nd July in the calculated field.

    I seem to remember that this guidance was on a page which held examples of calculating formula linked to dates.  If anyone can either point me to information they know of which documents this, or can advise on the methods and approaches, I will be very grateful.

    Regards - Merley72

    Filed under: ,
  • 06-12-2007 09:43 AM In reply to

    Re: Adding Months (or years) to a date field

    InfoPath 2007 provides date calculations. If you are in InfoPath 2003 or 2007, you can use managed code which has wonderful date functions, like AddMonths(). If you are using script, you will need to do all the footwork yourself to make this function as it should. You should be able to find appropriate help in a JScript or VBScript forum.
  • 04-11-2009 04:44 PM In reply to

    Re: Adding Months (or years) to a date field

    How would you do this?  I am having the same problem

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.