0

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

null
    • Nick
    • 4 yrs ago
    • Reported - view

    Try this formula

    WorkEnd - WorkStart

    • pablormago
    • 4 yrs ago
    • Reported - view

    I put in the duration field called 'Total', the formula Total = WorkEnd - WorkStart

    It does not work...

    • Nick
    • 4 yrs ago
    • Reported - view

    Screen Shot 2019-03-06 at 20.07.13

    • pablormago
    • 4 yrs ago
    • Reported - view

    Ok, thanks a lot

    • Standpunktet
    • Jan_Inge_Iversen.1
    • 2 yrs ago
    • Reported - view

    How to convert this (8:30) to 8,5 ours, so I can get a price for spended time?

    • Mconneen
    • 2 yrs ago
    • Reported - view

    @Jan, 

    Use a Time Interval field.    Then set that field equal to the end time - start time.... and select the desired format.   POOF. 

    2020-05-31_15-26-34

    • Jan_Inge_Iversen
    • 1 yr ago
    • Reported - view

    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??

    • Jan_Inge_Iversen
    • 1 yr ago
    • Reported - view

    @Mconneen

    • Fred
    • 1 yr ago
    • Reported - view

    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.

    • John_Halls
    • 1 yr ago
    • Reported - view

    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

    • Créateur de bien-être
    • Sebastien_Guillet
    • 3 mths ago
    • Reported - view

    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

  • 3 mths agoLast active
  • 11Replies
  • 3225Views
  • 1 Following