Calculating minutes between two dates

I am trying to use the d2:minutesBetween expression to calculate the minutes between clinical arrival date and when XX happens. They are both type = datetime as stipulated in the documentation.

However, when trying to use this formula, it is giving me an error, while d2:daysBetween works. Is it the case that the minutes version has a bug? Has anyone else experienced this issue? Has anyone else used d2:minutesBetween succesfully? I cannot find any additional guidance online.

Here is a screenshot below. Thanks in advance for any guidance! Just seems odd to get this error, as the structure of the function is pretty straightforward.

Sara

1 Like

Hi Sara,

Did you try to save the indicator and run analytics?

As far as I understand, dhis2 analytics uses different parsers to validate and evaluate expressions. This means that in some versions, an expression may be validated as “not valid” in the UI, but would still actually be calculated.

For example, d2:minutesBetween() works in 2.32 demo, but not 2.29 demo

Luckily, @Jim_Grace is working on a system to unify validation and evaluate across validation rules, program rules, and program indicators with a common ANTLR expression grammar https://jira.dhis2.org/browse/DHIS2-4469

3 Likes

Hi @brian many thanks for your reply. I did try saving and running analytics and it is still not working…I am just getting false as the indicator output.

If anyone else has any ideas of how to find the minutes between two datetime variables, without having to create a separate variable for hour and minute, please let me know.

1 Like

Hi Sara!
Which version of DHIS2 are you running?

UPDATE: Reading in another thread that the problem is on 2.30.

Markus

2 Likes

Hi Markus,

Yes, I am using 2.30 - any advice for a work-around?

1 Like