Difference in Months between 2 dates - InfoPath Dev
in

InfoPath Dev

Difference in Months between 2 dates

Last post 11-11-2010 04:45 AM by Mgauf. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-09-2010 05:14 AM

    • Mgauf
    • Top 500 Contributor
    • Joined on 07-28-2009
    • Posts 29

    Difference in Months between 2 dates

    I am looking for a solution for to show the difference in months between two dates. I tried the Excel solution (=(YEAR(LDate)-YEAR(EDate))*12+MONTH(LDate)-MONTH(EDate)), but get a formula error: "'YEAR' is not a valid XSLT or XPath function.".

    Any assistance would be aqppreciated.

     

    Thanks

  • 11-09-2010 05:25 AM In reply to

    Re: Difference in Months between 2 dates

    Perhaps I'm oversimplifying the problem, but I'm attaching a form that does some simple calculations.

    If you'd like something more robust (taking days/hours into account), you could use the DiffDate command in qRules.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 11-09-2010 07:47 AM In reply to

    • Mgauf
    • Top 500 Contributor
    • Joined on 07-28-2009
    • Posts 29

    Re: Difference in Months between 2 dates

    I failed to mention that the date picker fields can be more than 1 calendar year. For example, i would need a formula that would resolve the difference in months between 11/1/2010 and 11/1/2008. Thanks again for your assistance.

  • 11-09-2010 07:55 AM In reply to

    Re: Difference in Months between 2 dates

    How about

    (12 * (substring(date2, 1, 4) - substring(date1, 1, 4))) + (substring(date2, 6, 2) - substring(date1, 6, 2))

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-11-2010 04:45 AM In reply to

    • Mgauf
    • Top 500 Contributor
    • Joined on 07-28-2009
    • Posts 29

    Re: Difference in Months between 2 dates

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