Formula to calculate the duration in Hours and minutes of a work
I have to fields "WorkEnd"(End Hour field type) and "WorkStart" (Start Hour Field type), how can i calculate the duration of the work in hours and minutes and show it in a field called "Total"???
Thanks in advance.
11 replies
-
Try this formula
WorkEnd - WorkStart
-
I put in the duration field called 'Total', the formula Total = WorkEnd - WorkStart
It does not work...
-
-
Ok, thanks a lot
-
How to convert this (8:30) to 8,5 ours, so I can get a price for spended time?
-
@Jan,
Use a Time Interval field. Then set that field equal to the end time - start time.... and select the desired format. POOF.
-
What??
If I am gonna entertain in a pub for an example, I usally starts around 22:00 (PM) and play until 01:30 (AM), okay?
The answer is gonna be "-20.5 h", how do you explain that?? -
@Mconneen
-
If you use a Date/Time field, Ninox does the math properly.
I have a test DB with a clockIn field and clockOut field that are Date/Time fields. Then I have another formula field that takes clockOut - clockIn and I get the proper time. Now that you are using Date/Time fields you now have to be aware that Ninox, behind the scenes, uses milliseconds.
Then you have to have another field that converts the milliseconds to a meaningful number: number(HoursWorked / 3600000).
Give it a try and let us know how it goes.
-
Hi
Fred's answer is the correct way to go but if you want to stick to a time field use an if stataement to check if your duration is positive or negative and add 24 to the answer if it's negative. You can see that for your -20.5 above, 24-20.5 gives the correct answer, 3.5..
Doing the same without an if statement can be done with this...
TimeEnd-TimeStart+((sign(TimeEnd-TimeStart)-1)*-12)
Regards John
-
Hello, if it helps, I managed to create a formula to calculate sleep time. I tell myself that this formula can be applied to many other things related to a difference between 2 moments.
if sign(Awakening - Sleep) - 1 then
Awakening - Sleep + 86400000
else
Awakening - Sleep
end + Siesta'The destination field is a formula field.
Content aside
- 1 yr agoLast active
- 11Replies
- 3394Views
-
1
Following