Date and time

0
Hi Experts, Hope you are doing good!   I have one blocker, mentioned as below I am using start date/time and End date/time atributes based on which I am calculating duration. and now i want to check if the time exceeds 24 hours then i need to add row related to same record to show amount of time that exceeding 24 hours and also change the date at the same time.   how can i achieve this please advise?   Thanks for all ideas and suggestions!
asked
2 answers
3

Hi Malay,

you can use the hoursBetween() function, which will help you to get the number of hours between start and end time, and on the base of that, you ccan write your own logic of adding lines.

 

Let me know, if you hae any issues,

Hope it helps!!

answered
0

Hello,

You can take a look at calculating the difference between two dates https://docs.mendix.com/refguide9/between-date-function-calls/

or the other way around look at adding or subtracting time to/from a date

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

https://docs.mendix.com/refguide9/subtract-date-function-calls/

But the second part of your question I don't really get. Adding a related record is not difficult, but what date are you trying to change? Be aware that if time elapses the difference between dates becomes larger as well and depending on if you want to display the actual/current difference you might want to look in using a calculated attribute. To be able to execute logic on a regular basis (eg check every hour if the '24 hours' passed for a record and then create/update records) you can use scheduled events.

Hope this helps

answered