What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Can Weekends be Excluded from the Results of DateTime Calculations?

    Asked by jenebo on October 07, 2015 at 11:27 AM

    Part of one of our forms is a user requesting something done by slecting a radio button of 3 days. 2 weeks, 3 weeks, etc. To add to this, we have an "other" field that I think I can populate using a "date" field that would be filled out below the radio button section (maybe make the choosable date filed appear if the :other" radio button is selected).

    What my real question is, how do I have the form generate a date that that customer can expect to have their services complete by based on WORKING days (Monday through Friday), excluding weekends (and holidays if possible) and display that?

     

    Thanks

    Page URL:
    http://form.jotform.us/form/52646032831148

    selected exclude weekends exclude holidays date calculations only weekdays
  • Profile Image
    JotForm Support

    Answered by BJoanna on October 07, 2015 at 02:10 PM

    If I understood you correctly you want to calculate number of days, between start date and end date, but you want to exclude weekends and holidays. Unfortunately it is not possible to exclude weekends and holidays when using a date calculation.

    However it is possible to calculate difference between two dates. Here is my sample form:

    http://form.jotformpro.com/form/52795517569977?

    I have added two DateTime fields and used form calculation widget to calculate difference between dates. https://www.jotform.com/help/259-How-to-perform-calculation-in-the-form 

    Feel free to clone it

    You can also use our "Limit Dates" feature, if you do not want that your users select weekends in DateTime field. Inside of this guide you can find out how to do it:

    https://www.jotform.com/help/337-How-to-Use-the-Limit-Dates-feature-in-a-DateTime-field 

    Hope this will help. Let us know if you need further assistance.

  • Profile Image

    Answered by dakotahorizons on October 08, 2015 at 12:08 PM

    What we are looking to do is take today's date, add a specified amount if time to it in days, and output the calculated date.

    The output date cannot be a weekend and if possible, the calculation cannot include weekends.

     

    Is this possible?

  • Profile Image
    JotForm Support

    Answered by ashwin_d on October 08, 2015 at 02:25 PM

    Hello dakotahorizons,

    What we are looking to do is take today's date, add a specified amount if time to it in days, and output the calculated date.

    I have understood your this requirement and it seems to be achievable. 

    Can you please explain your next requirement on what happens if the output date is a weekend.

    We will wait for your response.

    Thank you!

  • Profile Image

    Answered by dakotahorizons on October 08, 2015 at 05:12 PM

    We do not want weekends to count as part of the output calculation, nor do we want the output date to be a weekend.

  • Profile Image
    JotForm Support

    Answered by abajan on October 08, 2015 at 08:20 PM

    Unfortunately, excluding weekends from the output calculation doesn't appear to be feasible. (There's actually currently at least one ticket about this.) However, let me see if I can devise a workaround of some sort and get back to you.

    Thanks

  • Profile Image
    JotForm Support

    Answered by abajan on October 08, 2015 at 10:13 PM

    Hi again,

    Please test this form and note the date displayed in the Result field as different selections are made in the Due Date field. Is that the sort of functionality you wanted?

    We'll await your reply.


    Thanks

  • Profile Image

    Answered by jenebo on October 14, 2015 at 11:18 AM

    Hi abajan,

    Yes, this is EXACTLY what we were looking for. Now, how do I make this work in my form?

     

    Thanks again

  • Profile Image
    JotForm Support

    Answered by ashwin_d on October 14, 2015 at 01:31 PM

    Hello jenebo,

    I am glad to know that my colleague's workaround works for you. Can you please let us know in which field of your form you want the result/date excluding dates to be displayed? We will surely try to help you. Is it "Date:" field below the "Name of Event" field?

    We will wait for your response.

    Thank you!

  • Profile Image

    Answered by dakotahorizons on October 14, 2015 at 05:28 PM

    I have made a read-only field called 'Expected Completion Date."

     

    Thank you for all your help!

  • Profile Image
    JotForm Support

    Answered by abajan on October 14, 2015 at 09:38 PM

    Hi again,

    Please clone this clone of your form (see this guide) back to your account and note the following:

    1. A date field has been inserted and its Default Date has been set to the Current:


    2. The said field is hidden:


    3. The following calculation values have been added to the Timeline field:

    (Since a week is equal to seven [7] days, 7 and 14 have been used as the calculation values for 1 Week and 2 Weeks respectively.)


    4. A text box field labelled Evaluate has been added to the form and it is hidden

    5. Four (4) Update a Form Field Value conditions have been added to the form:

    Carefully examine each of them and after a while the logic of their settings should become clear but if you need help understanding any of this, please inform us.

     

    Cheers