-
usimig2020Bom dia,
Seria possível saber quantos dias de diferença há entre 2 datas?
Por exemplo: a data de envio e a data de execução, para que eu consiga saber a quantidade de dias da diferença das datas.
-
Podo: Support AI AgentOi,
Obrigado por entrar em contato com o Suporte Jotform. Posso ajudar você com isso.
Para calcular a diferença em dias entre duas datas, como a data de envio e a data de execução, você pode usar a função DATETIME_DIFF em Jotform Tables. Essa função retorna a diferença entre duas datas em unidades especificadas, como dias.
Veja como fazer:
- Abra sua tabela no Jotform Tables e adicione uma nova coluna.
- Escolha o tipo de coluna como Fórmula Avançada (Advanced Formula).
- Use a fórmula: =DATETIME_DIFF({Data de Execução},{Data de Envio},"days") substituindo {Data de Execução} e {Data de Envio} pelos nomes reais das colunas das datas no seu formulário.
Isso calculará automaticamente a quantidade de dias entre as duas datas para cada linha da tabela.
Além disso, você pode usar o widget Date Difference no construtor de formulários para calcular a diferença entre datas diretamente no formulário, se preferir.
Se precisar de ajuda para configurar isso, me avise.
Experimente e me diga como foi.
-
usimig2020e quando um dos campos está vazio como eu uso o IF para ele retornar vazio, caso o campo esteja vazio
-
Podo: Support AI AgentOi,
Para usar a função IF em uma fórmula avançada no Jotform Tables e fazer com que retorne vazio caso um dos campos de data esteja vazio, você pode estruturar a fórmula assim:
=IF(OR(ISBLANK({Data de Envio}), ISBLANK({Data de Execução})), "", DATETIME_DIFF({Data de Execução}, {Data de Envio}, "days"))
Essa fórmula faz o seguinte:
- Verifica se {Data de Envio} ou {Data de Execução} estão vazios usando ISBLANK.
- Se algum dos campos estiver vazio, retorna uma string vazia "".
- Se ambos estiverem preenchidos, calcula a diferença em dias entre as datas com DATETIME_DIFF.
Assim, você evita que a fórmula retorne um valor quando uma das datas não estiver preenchida.
Se precisar de mais ajuda, estou à disposição.
-
usimig2020 -
Mikhail Jotform SupportHi usimig2020,
Our Portuguese Support agents are busy helping other Jotform users right now, so 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, it might take a while until they're available again.
Now, coming back to your question, I understand the issue. Let me look into it and get back to you with a solution.
-
Mikhail Jotform SupportHi usimig2020,
Can you give me a few more details so I can understand what you need? Do you have a custom table created without any connected form? If it’s connected to a form, can you share your form link with me so I can take a closer look?
Also, if it's connected to a form, you can add Date Difference Widget to get the days difference between two dates. Currently, you can't display the Number of Days calculated by the Date Difference Widget directly. But, there’s a workaround to show it in your form. Let me show you how to do it:
1. In Form Builder, click on Add Element on the left side of the page.
2. Then, in the menu that opens, click on Widgets in the top-right corner.
3. Next, click on the Form Calculation Widget to add it to your form.
4. In the menu that opens on the right, click on the Add Field button.
5. Then, select the Date Difference Widget in the Dropdown menu.
That’s it. As soon as your Date Difference widget is filled out, the date difference between the entered date will be displayed in the Form Calculation widget. Check out this screencast below: Reach out again if you need any other help. -
usimig2020Não queria colocar no formulário, mas acrescentar como uma coluna na tabela
-
Mikhail Jotform SupportHi usimig2020,
Can you try using the formula below on your Table?
=IF(OR(YEAR({startdate})=1900,YEAR({enddate})=1900),"",DATETIME_DIFF({stardate},{enddate},"days"))
This is what it looks like when a field is blank:
Give it a try and let us know how it goes.
-
usimig2020Deu certo, obrigada
-
Podo: Support AI AgentHi usimig2020,
Your request has been answered and the thread is closed.
If you have another question or need more help, feel free to reply here and we’ll assist you right away.
Your Reply
Something Went Wrong
An error occurred while generating the AI response. Please try again!