Page 1 of 1

How to calculate the difference between dates

Posted: Wed Apr 02, 2025 9:19 pm
by Mosufe
I'm trying to calculate the difference between a date field and today. I've tried a lot of thing and none seems to work... Basicly what i need to do is:

Code: Select all

DateDiff(
  Today(),
  {vw_mtz_tk_solicitacao_servico_v3.data_solicitacao_servico},
  DateInterval.Day)
  
And the date field is a string, how can i cast it to date?

Re: How to calculate the difference between dates

Posted: Wed Apr 02, 2025 9:59 pm
by Lech Kulikowski
Hello,

Try to use:
{DateDiff(Today, DateTime.Parse(fw_mtz_tk_solicitacao_servico_v3.data_solicitacao_servico)).Days}

Thank you.

Re: How to calculate the difference between dates

Posted: Thu Apr 03, 2025 12:34 pm
by Mosufe
I'm getting this bizarre error now:

Image

Someone have a documentation that explain how to create the calculated fields? I'm not finding it...

Re: How to calculate the difference between dates

Posted: Thu Apr 03, 2025 10:06 pm
by Lech Kulikowski
Hello,

Please clarify what product and version you use.

Thank you.

Re: How to calculate the difference between dates

Posted: Fri Apr 04, 2025 3:43 pm
by Mosufe
We use the Report JS version 2025.1.4

Re: How to calculate the difference between dates

Posted: Fri Apr 04, 2025 7:30 pm
by Lech Kulikowski
Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.