How to add days to date

  • Profile Image
    plott
    Asked on September 21, 2017 at 02:02 PM

    I am trying to add some days (from another field) to a date (from a datepicker) based on this:

    https://www.jotform.com/answers/986233-Date-calculation-Adding-63-days-on-the-selected-date

    However, my example doesn't work.

    I'd like calc2 to contain the addition of grunt + calc3

    Could you have a look?

  • Profile Image
    aubreybourke
    Answered on September 21, 2017 at 03:31 PM

    Yes its possible. I cloned your form and have it working here:

    https://form.jotformpro.com/72636038757970


    You were nearly right. But the calculation field needs to look like this:

    Note: If you click on a field here in the calculation it changes colour. Brown indicates a String of text. While black indicates a number. So you first add the numbers in brackets and the result is fed to the dateString function, which returns a textual representation of the date.


  • Profile Image
    plott
    Answered on September 21, 2017 at 06:27 PM

    OK, I've now added another calculated field to my form (Week #1).  From my eye it appears to be identical to Payroll date, but using a hard-coded number rather than a field.

    What am I doing wrong?

  • Profile Image
    jonathan
    Answered on September 21, 2017 at 09:35 PM

    I reviewed your form on my browser and I can see the field Week#1 do have the correct calculated value base on the formula.

    and


    output:


    Can you please confirm this is resolved already? Let us know if still not.

    Thanks.

  • Profile Image
    plott
    Answered on September 22, 2017 at 07:07 AM

    Yes, I was able to resolve it, but only by adding another field and adding two fields, rather than adding a field and a number.  Should I be able to add a date + a number?

    Thanks for your help!

  • Profile Image
    candy
    Answered on September 22, 2017 at 10:42 AM

    I have also cloned your form on my side in order to find another workaround. 

    I have seen that first, you have to calculate "Week One Off Set" and then, you should calculate the "Week #1" depends on it, so that's why you need to have double fields for this kind of calculation. So, I couldn't find any possible workaround to calculate those values only with a single field. 

    For detailed information, please check the following guide: https://www.jotform.com/help/443-Mastering-Date-and-Time-Calculation 

    If you need any assistance, do not hesitate to contact us.

    Thank you.