How do I calculate days elapsed (excluding weekends) on form submission?

  • Profile Image
    EPRU_CCDPH
    Asked on December 14, 2017 at 03:38 PM

    I searched the help archive, and it appeared as if the Dates Difference widget would help, but it has not proven to work. 

    I have a form which requires users to submit attendance records for training within two business days of the training.  I'd like to flag the submission somehow if that difference is greater than 2 business days, and perhaps display a gentle reminder to be more compliant in the future.

  • Profile Image
    agonhasani
    Answered on December 14, 2017 at 04:30 PM

    You don't need widgets for this.

    Here is an example form I made:

    https://form.jotformeu.com/73467341990363


    To achieve this add a conditional with the following settings:

    1513286870scrrr.png


    To recap, what I did I created a text element with the reminder text and hidden it in the advanced properties.
    Then I created a Show/Hide condition with the settings you can see in the image above.

  • Profile Image
    Kevin_G
    Answered on December 14, 2017 at 06:48 PM

    As far as I know it's not possible to count days between two dates and exclude weekends, but you may get the date string of the result date and know if it's either Sunday or Saturday, then you may show a message  indicating the user that the data is not valid and/or hide the submit button. 

    Please find details about the datestring() function here: https://www.jotform.com/help/267-Form-Calculation-Math-Function-Reference 

    This guide will also help you showing/hiding fields: https://www.jotform.com/help/316-How-to-Show-or-Hide-Fields-Base-on-User-s-Answer 

    I hope this helps.