Hello All,
We need to calculate number of hours between two date and time values. and this should not consider weekends.
Thanks in advance
Discussion posts and replies are publicly visible
Just subtract the two dates. It will return an interval. That format is a bit weird, but you will find enough coding examples to parse it here.
a!localVariables( local!interval: split(userdatetime(2024,7,26,1,1,1) - userdatetime(2024,7,20,3,3,3), ":"), local!interval[1]*24 + local!interval[3] )
You could try using the calworkhours function.
docs.appian.com/.../fnc_date_and_time_calworkhours.html
Thank you Stephen. But it should not consider weekend hours.
Eg: Start Date time : 07/26/2024 11:00AM
End Date time : 07/29/2024 11:00AM
should give us 24 hours. It should ignore weekend hours.
Thank you Mathieu Drouin, this considers only week hours. But my use case is only not to consider weekend hours.
If so , Use Stefan's logic ,but somehow you need to find out how many weekdays are there or In default working calendar weekends are considered non working days , So use calworkingdays() .
a!localVariables( local!workdays:calworkdays(ri!startTime,ri!endTime-1), (hour(ri!endTime-ri!startTime)+local!workdays*24) )