1

I have two datetime fields ("date1" and "date2") and want to use the most resent date to use it in this expression (getting the age in days):

round(day(age(now(),"recent_date")),0)

"recent_date" should be the the more recent field of "date1" or "date2"

1 Answer 1

3

Use array_max, as it supports datetime natively (in contrast to max which requires a conversion to epoch <double>):

round( day( age( now(), array_max( array( "date1", "date2" ) ) ) ), 0 )

With epoch conversion:

round( day( age( now(), max( epoch( "date1" ), epoch( "date2" ) ) ) ) ), 0 )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.