How To Calculate Number of Days Between Two Dates - InfoPath Dev
in

InfoPath Dev

How To Calculate Number of Days Between Two Dates

Last post 06-23-2007 01:56 PM by Clay Fox. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-21-2007 11:41 AM

    How To Calculate Number of Days Between Two Dates

    I am trying to calculate the number of work days between to days.  Has anyone done something similar or have any suggestions on how I might be able to accomplish this?  Basically, I am testing a vacation request from that has a "from" and a "to" field.  A third field, called "days", be populated with the number of days once both days are entered.

     

    Thanks in advance.
     

  • 06-23-2007 01:56 PM In reply to

    Re: How To Calculate Number of Days Between Two Dates

    This is fairly common and too bad that InfoPath has not put a function in to support this so you have to use script.

    There are a couple different approaches but I have used a pretty simple vbscript using the DateDiff function. Here is a pretty good thread. http://www.infopathdev.com/forums/thread/9236.aspx

    First if you have not used code yet is the syntax of referencing your fields and the second is using the Datediff function. You should be able to search on both and get the answers you need.

    Here is a sample I had in the onload event to calculate 90 days in advance from today to show imminent items.

    Pasting did not work so well so i have attached it.

     

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