Hi, I have two date time attributes. One for Start Time and another for End time. I used the hours between function to calculate the hours between these two attributes. hoursBetween($TimeSheetTaskActivity_2/TaskStartTime,$TimeSheetTaskActivity_2/TaskEndTime). User enters the task on hourly basis for the day. The 1st entry of TaskStartTime the user can enter, and from the next hour the TaskStartTime will be prepopulated from the last TaskEndTime. User has to submit tasks for min of 9 hours. It is working fine on daily basis. I have a scenario where when the user enters tasks only say upto 8 hours (the min 9 hours work hour condition is not met) so the user is not able to submit the tasks. The next day if the user has to enter the tasks, the previous day tasks has to be submitted. So the remaining one hour task has to be entered. The problem here is since the TaskStartTime is Prepopulated from TaskEndTime (say its 5:00 pm yesterday’s datetime )and now TaskEndTime is given as 6:00 pm the hours between is calculated as 26 hours. Because the StartTime is yest date 5:00 pm and EndTime is today 6:00 pm. How do I resolve this issue and calculate hours with only the time without considering the date.
Ramya, I believe you should adjust the date part of TaskEndTime to match with the date part of TaskStartTime. After that, you can use the function hoursBetween without issue.
Hope it helps.
What you need is a end condition.
What if you have a variable set with END_OF_DAY constant?
Then when you are calculating the next TASK_START_TIME, you calculate as per your current logic itself but check if it has reached the END_OF_DAY. If yes, then you can put a hard coded TASK_START_TIME.