Can we calculate/present a week number?

  • Profile Image
    Roel1985
    Asked on January 09, 2017 at 02:29 AM

    Hello,

    Is it possible to show a weeknumber. When i enter a date the form can calculate the week number?

     

    Thank you,

  • Profile Image
    Charlie
    Answered on January 09, 2017 at 04:41 AM

    What week number are you referring to? Is it the week number on a month or the whole year?

    We do not have a direct function that presents a week number, but if you are familiar with its formula, I believe you can use the form calculation widget or the conditional logic to get it. Here are the guides that might help:

    https://www.jotform.com/help/259-How-to-Perform-Form-Calculation-Using-a-Widget 

    https://www.jotform.com/help/268-How-to-Insert-Text-or-Mathematical-Calculation-into-a-Field-Using-Conditional-Logic 

     

    We'll wait for your response.

  • Profile Image
    Roel1985
    Answered on January 09, 2017 at 05:11 AM

    Hello,

     

    I refer to the weeknumber each year has 52 or 53 weeks. Like this year 2 jan 2017 - 8 jan 2017 is week 1 of this year.

  • Profile Image
    Mike
    Answered on January 09, 2017 at 06:45 AM

    Unfortunately, we do not have an existing function or example to provide you with. In theory, it might be possible to use some set of calculation rules to calculate the week number depending on one of the standards, but we still cannot guarantee that.

    It might be easier to use some tested solution, for example it might be possible to use a form source code and custom javascript to calculate the week number. Please see the next article for more information on this topic.

    Calculate ISO 8601 week and year in javascript

    Thank you.

  • Profile Image
    Roel1985
    Answered on December 07, 2018 at 07:32 AM

    And now?

  • Profile Image
    Victoria_K
    Answered on December 07, 2018 at 11:54 AM

    Now we have a new help article on mastering date and time calculations. You may review it here: Mastering-Date-and-Time-Calculation

    As far as I understand, you would like to get current week number on the form, is this correct? 

  • Profile Image
    Roel1985
    Answered on December 08, 2018 at 05:18 AM

    Hello,


    Yes i want to calculate the current weeknumber on the form.

  • Profile Image
    Victoria_K
    Answered on December 08, 2018 at 08:34 AM

    I can suggest the following:

    1. To add a Date Picker field to a form, which would hold a value of first day of the first week. This field can be hidden on a form:

    154427552746a83.png

    2. Another Date Picker would capture the date entered by respondent, you could set current date as default if needed. 

    3. 'Form Calculation' widget can calculate number of current/selected week with the following formula: 

    floor( (Date - First day of first week) / 7) + 1

    154427579229vjh.png

    Here is a test form: https://form.jotform.com/83413000652948 

  • Profile Image
    Roel1985
    Answered on December 10, 2018 at 02:12 AM

    Great. This works. Only i have to do this every year. :)