DHIS2.33: Programrule to compare 2 dataelements with datetime and Date data type

Hi All,
am currently trying to set up a Programrule that compares 2 dataelements:
“Date Seen in facility”: Date datatype
“Date time specimen collected”: Datetime datatype.

Now when I set up a program rule using d2:daysBetween(#{DateSeenInFaciliy}, #{DateSpecimenCollected})<0 it does not work and always give me negative value after displaying the result in the Indicator widget (see image).

Now I have tried to use d2: left(#{DateSeenInFaciliy}, 10) function to only take the date in the formate ‘YYYY-mm-dd’ and it still does not work.
Does anyone have a solution on why to compare those two dates? or having the same challenges?

Hi there Djibril!
It does seem like one of the variables is not containing a date. Can you for the sake of testing make a “display text” rule to display the contents of #{DateSeenInFaciliy} and #{DateSpecimenCollected}?

Best regards,

Hi Markus,

thank you for your response, I could clearly see that the date formats are not the same: dd-MM-yyyy and yyyy-MM-dd hh:mm. I will try to construct a correct format by switching the year and the day and see how it goes.
Just not that the system setting language and appearance is in french and the data format to dd-MM-yyyy.

Date seen at facility display:


Date time lab specimen taken display


Hi Markus,
I manage to fixed the issue by switching, using function, the year and the day to have the same format as “date seen at facility” and assign it to a temp variable rule… BUT the datetime format should also follow the same set on system setting. am not sure if this a bug or I missed something.