Calculate date range

0
Hi guys, Anyone know how to calculate date range? I have a task to put a restriction for staff who did not reached one year period working at my company, cannot apply the form. Is there any way to calculate the staff working period? Thanks for your help.
asked
3 answers
4

Hi Muhammed,

First While creating your staff object, maintain joining date. 

While creating a form check daysBetween($joiningDate,[%CurrentDateTime%]) , if it is greater than 365, you can allow them to create a form.

Also there is function yearsBetweeen.

Hope this helps!

answered
0

Hi Muhammad Ikhwan Afiq bin Azmir
You can Create a Validation microflow.
Compare the days between the current date and the join date, it will return a number of days. put a condition who can edit the form based on the number of days greater than 365
 

answered
-1

Hi Muhammad Ikhwan Afiq bin Azmir,


You can always use DateTime function in Mendix. you can use days between functions. You can decide on how to handle it. You can keep two date Time Attributes  one for Onboarding date and another expiry date( Can calculate this while Commiting the object . Make use of AddDays/AddMonths/Addyears Function  and Save it. Now based on the Expiry date you can handle your Button visibility etc.. 
 

https://docs.mendix.com/refguide/add-date-function-calls/

https://docs.mendix.com/refguide/between-date-function-calls/

 

Hope this helps!!

 

answered