Can we calculate/present a week number?

  • Roel1985
    Asked on January 9, 2017 at 2:29 AM

    Hello,

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

     

    Thank you,

  • Charlie
    Replied on January 9, 2017 at 4: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.

  • Roel1985
    Replied on January 9, 2017 at 5: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.

  • Mike
    Replied on January 9, 2017 at 6: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.

  • Roel1985
    Replied on December 7, 2018 at 7:32 AM

    And now?

  • Victoria_K
    Replied on December 7, 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? 

  • Roel1985
    Replied on December 8, 2018 at 5:18 AM

    Hello,


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

  • Victoria_K
    Replied on December 8, 2018 at 8: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 Screenshot 10

    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 Screenshot 21

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

  • Roel1985
    Replied on December 10, 2018 at 2:12 AM

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