How Do I Have a Field Display a Date Which Is a Specified Number of Days Prior to That Selected in a Date Field?

  • Profile Image
    lauren.whiteaker
    Asked on July 08, 2015 at 06:02 PM

    is there a way to calculate a date based on another date entered in a different field? i.e. Date of Demo would produce a Call Date seven days prior based on the date entered for demo?



    This is a re-post of a comment on How to Pass Field Value to Another Field?

  • Profile Image
    EltonCris
    Answered on July 08, 2015 at 08:16 PM

    Yes that's possible. You can achieve it by creating conditions (Example form: https://www.jotform.com/form-templates/calculate-number-of-days, feel free to clone it so you can check the conditions) or by using this widget. http://widgets.jotform.com/widget/dates_difference

    Then use a form calculation widget to get the result. Example:

    Hope this helps!

  • Profile Image
    abajan
    Answered on July 08, 2015 at 09:27 PM

    Hi Lauren,

    In addition to my learned colleague's solution, please see this form which uses another method. If you were to clone it and examine its saved condition, you'll see the following:

    To construct the expression seen in the work area above, I clicked the button with the ellipses (...) and then clicked the dateString() method:

    Then I clicked the Back button (in the screenshot above), clicked between the parentheses to place the insertion point there and clicked Add Field and inserted the demo date field:

    Then it was just a matter of typing -7 after it to output a date seven (7) days earlier.

    If any of this is unclear, please inform us.

    Cheers

  • Profile Image
    lauren.whiteaker
    Answered on July 09, 2015 at 10:03 AM

    This worked great! Thanks so much!!!

  • Profile Image
    EltonCris
    Answered on July 09, 2015 at 11:38 AM

    @lauren.whiteaker

    Glad to hear it.

    Cheers!

  • Profile Image
    kingfisherweddings
    Answered on February 06, 2016 at 07:28 AM

    How do you get the conditions wizard to look like that I can only get the calculation wizard to do this. And I cannot get it to work. How frustrating it is grrrrr
  • Profile Image
    kingfisherweddings
    Answered on February 06, 2016 at 11:31 AM

    Great idea but even though i cloned the form it didn't work :(

  • Profile Image
    Boris
    Answered on February 06, 2016 at 08:46 PM

    @kingfisherweddings in order to assist you better and so that are messages are not sent to all previous participants of this support thread, your question has been moved to a support thread of its own:

    http://www.jotform.com/answers/766252

    We will assist you with your question there, shortly. Thank you.