Quantidade de dias de um determinado Mes entre duas datas

  • artemixrojo
    Perguntado em 4 de abril de 2024 às 08:21

    Bom Dia

    Preciso criar uma formula que traga o seguinte?

    Tenho a data de Check-in e a Data de Check-out

    Tambem criarei um campo para somar os dias de cada mes - TotJan, TotFev, etc...

    Preciso que esses campo calculem a quantidade de dias de um mes no intervalo das datas de Check-in e Check-Out


    Exemplo:


    Check-in - 20/01/2024

    Check-Out - 15/02/2024


    Logo


    TotJan = 11 dias

    TotFev = 14 dias


    É possivel?




  • Jefferson Jotform Support
    Respondido em 4 de abril de 2024 às 13:45

    Hi Artemio,

    Thanks for reaching out to Jotform Support. Unfortunately, our Portuguese Support agents are busy helping other Jotform users at the moment. I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in Portuguese, let us know and we can have them do that. But, keep in mind that you'd have to wait until they're available again.

    Now, let me help you with your question. I understand you would like to calculate the number of days per month based on the check-in and check-out dates. Unfortunately, it's not possible to get the total number of days per month. The only workaround is to calculate the number of days for the two dates directly. Let me show you how:

    1. In Form Builder, click the Add Form Element button and add two date pickers and one number element to your form. Quantidade de dias de um determinado Mes entre duas datas Image 1 Screenshot 40

    Next, we need to add a condition to calculate the number of days for two dates:

    1. In Form Builder, click on the Settings tab in the orange navigation bar at the top of the page. 
    2. Click on the Conditions tab on the left side of the page and click on Add Condition.
    3. Select the Update/Calculate Field and select the following details:
    4. IF: Check In
    5. STATE: Is Filled
    6. Click the plus button to add another rule.
    7. IF: Check Out
    8. STATE: Is Filled
    9. Set the Rules Matched as All.
    10. DO: Calculate Field Value
    11. Click the Add Field button and select the Checkout date.
    12. Add a minus symbol after the Checkout date.
    13. Click the Add Field button and select the Checkin date.
    14. Hit on Save to update changes in your Condition. Quantidade de dias de um determinado Mes entre duas datas Image 2 Screenshot 51

    That's it! Test your form, and you should see that it displays the number of days based on selected dates. Check out my screencast below:

    Quantidade de dias de um determinado Mes entre duas datas Image 3 Screenshot 62

    Give it a try and let us know how it goes.