you can use the function daysBetween(). You’ll find documentation here: https://docs.mendix.com/refguide/between-date-function-calls#6-daysbetween
I would recommend looking at the following functions to achieve what you are looking for
https://docs.mendix.com/refguide/between-date-function-calls#6-daysbetween