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

    Is there a way to calculate the day of the year considering leap years

    Asked by Mareid on September 17, 2014 at 05:04 PM

    Is there a way to capture the day-of-the-year (e.g. September 1 i s day 244 in non leap years)

    I want to set up my for so that if the this year is not a leap year (i.e. it is not divisible by 4) and the day of the year is between 152 and 365, the cost to register is $15, otherwise it's $30.


    I don't know how to calculate the day of the year within the form. And I need to be able to determine whether the year itself is evenly divisible by 4 (in which case it is day 153 and 366)



  • Profile Image
    JotForm Support

    Answered by Mike_T on September 17, 2014 at 06:34 PM

    Thank you for contacting us. 

    You might consider the following workaround.

    Add the standard $30 price to your calculation field.

    And set up an 'Update a form field value' condition.

    It means that you will need to update that condition once a year to change the years.

    It is probably that there is a way to calculate the leap years and the day of the year based on a Form Calculation widget, since it can provide the dateString value (calculated based on a 1 January, 1970 UTC start date), but I have not found a solution yet.

    Please feel free to contact us if you need any further assistance.

  • Profile Image

    Answered by Mareid on September 17, 2014 at 11:01 PM
    I figured out a way to do it without having to modify the form every
    year. I checked which month we were in and the appropriate month
    triggers a value in a field. You can see how I did it on WGRI
    Membership Application Form.