Retrieve Day of Year from DateTime tool

  • Profile Image
    jaymiller
    Asked on December 04, 2014 at 12:52 PM

    Is is possible to retrieve the DoY from the DateTime tool?  I need the ability to calculate per diem based on a certain amount.

  • Profile Image
    Ben
    Answered on December 04, 2014 at 02:15 PM

    Hi,

    Unfortunately it is not possible to get the day of the week at this time, unless you take the source code of your jotform and implement this into it directly.

    Now I would like to forward this as a feature to our developers, but could you please tell us if by the day of the year you mean day of the week (Monday, Tuesday, etc) or the day of the year such as 1, 2, 40, 54, 200, etc?

    If you want to get the day number it might be possible, but would require certain tweak each year to show correctly.

    Best Regards,
    Ben

  • Profile Image
    Ben
    Answered on December 04, 2014 at 02:26 PM

    Hi,

    I have made a quick sample of how you could calculate the day of the year.

    http://form.jotformpro.com/form/43375183857970

    Do let us know if that is what you are after.

    Note: it only works for the current year.

    Best Regards,
    Ben

  • Profile Image
    jaymiller
    Answered on December 04, 2014 at 08:12 PM

    Thank you Ben,

     

    Could you please send me a copy or a link of your form?  

     

    The form needs to return the Day of the Year.  eg: 1/1/2014=1, 12/31/2014=365

     

    ps:  Using the current year is fine for what I need.

     

  • Profile Image
    jonathan
    Answered on December 05, 2014 at 06:46 AM

    Hi,

    Can you please clarify also the requirement? 

    From what I understand initially, is you wanted to know the Name of DoY?

    There is a template in the JotForm Template that does this without using the form's source code. It only uses Calculation.

    Here is the template http://www.jotform.com/form-templates/show-day-of-the-week

     

    BUT if what you meant you need is instead the Number of Days within a Year, then this template does the same

    http://www.jotform.com/form-templates/calculate-number-of-days

     

    If you want to clone the demo jotform http://form.jotformpro.com/form/43375183857970 created by Ben,  then follow this user guide on how to

    http://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL

     

    Hope this help. Please inform us if you need further assistance.

    Thanks.

     

     

  • Profile Image
    jaymiller
    Answered on December 05, 2014 at 10:51 AM

    Thank you for all your help.

     

    What I mean by Day of Year is Day Number of the current year.  

     

    The day of year is the sequential day number starting with day 1 on January 1st.

     

    I see with Ben's example a year default is set by hard coding a Julian date type value.  In the example, the "year entry" for 2014 is set to "16070.96".  Does 16070 represent January 1st, 2014?

  • Profile Image
    Ben
    Answered on December 05, 2014 at 12:07 PM

    Hi,

    Yes, I have hard coded the value of the January 1st of 2014 in the hidden box used to subtract the current/selected date value from, leaving the number of days in between.

    Now you can open the jotform and set it to 1st of January of 2014 and you will see it giving you 0 as the return value, since the days match.

    If you need it to be 1 instead of 0 you can always just add +1 to it.

    Do let us know if you have any further questions.

    Best Regards,
    Ben