Forum Discussion
yaman123
4 years agoPost Partisan
Calculate Duration from date time fields
Hi, Is there a way to calculate the duration in hours and minutes from a date time field? e.g From Date is 24/08/2021 04:03 and To Date is 25/08/2021 06:08. The Duration should be 26:05. ...
- 4 years ago
Hi, yaman123
You can try the following methods.
1. First convert all intervals to seconds.
Seconds = DATEDIFF ( [Start time], [End time], SECOND )2. Then convert the seconds to hour-minute-second format.
Duration = INT ( [Seconds] / 3600 ) & ":" & INT ( ( [Seconds] - INT ( [Seconds] / 3600 ) * 3600 ) / 60 ) & ":" & [Seconds] - INT ( ( [Seconds] - INT ( [Seconds] / 3600 ) * 3600 ) / 60 ) * 60 - INT ( [Seconds] / 3600 ) * 3600Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-zhangti
4 years agoCommunity Support
Hi, yaman123
You can try the following methods.
1. First convert all intervals to seconds.
Seconds =
DATEDIFF ( [Start time], [End time], SECOND )
2. Then convert the seconds to hour-minute-second format.
Duration =
INT ( [Seconds] / 3600 ) & ":"
& INT ( ( [Seconds] - INT ( [Seconds] / 3600 ) * 3600 ) / 60 ) & ":"
& [Seconds]
- INT ( ( [Seconds] - INT ( [Seconds] / 3600 ) * 3600 ) / 60 ) * 60
- INT ( [Seconds] / 3600 ) * 3600
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jtetz30
2 years agoRegular Visitor
Also, this will yield a string so I cannot math it further... Is this really the only answer