How to compare two dates in mendix microflow expression

0
which format is use to compare dates i.e. one date is given as input and I want to compare with todays date
asked
2 answers
1

Hi Akshay,

you can compare dates be formating it 

formatDateTime($variable,'dd/MM/yyyy')=formatDateTime('[%CurrentDateTime%]','dd/MM/yyyy')

 

 

answered
0

In an OQL-statement you can get someone’s current age using:

from "Sales.Customer" where DATEDIFF(YEAR, Birthday,'[%CurrentDateTime%]') >= 18
select FirstName, DATEDIFF(YEAR, Birthday,'[%CurrentDateTime%]');

Hoping there is a better way to do this in microflows (without jumping to java), but this is what I ahv got so far:

$BirthdayStillToComeThis Year:

parseInteger(formatDateTime([%CurrentDateTime%],'MMddHHmmss'))<
parseInteger(formatDateTime($Person/Birthdate,'MMddHHmmss'))

$CurrentAge:

parseInteger(formatDateTime([%CurrentDateTime%],'yyyy'))-parseInteger(formatDateTime($Person/Birthdate,'yyyy'))-
(if($BirthdayStillToComeThisYear)then 1 else 0)

Copy the solution from Marketplace module Person: https://marketplace.mendix.com/link/component/116181

answered