Help

Using DATETIME_DIFF with HOURS and DECIMAL rounds to whole number

Topic Labels: Formulas
Solved
Jump to Solution
5750 4
cancel
Showing results for 
Search instead for 
Did you mean: 

It appears that the DATETIME_DIFF() function rounds down to a whole integer when specifying hours regardless of it decimal is specified to two places.

4b5f02b8a5b001f75619bc260661eb9e6e0acc2e.png

5b79825b0cf589bfd2b022baf8e8d4ebb6ed505f.png

cf252b4da7bc2b94a684c99ddf52c224c71bea94.png

1 Solution

Accepted Solutions

Just following up with an additional idea, which seems like it will work for my needs:
DATETIME_DIFF({End Date-Time}, {Start Date-Time}, ‘minutes’) / 60

But I am still curious if there are other ways to specify the format of hours and minutes within the datetime_diff formula.

See Solution in Thread

4 Replies 4

I am also searching for this solution. Is this actually a bug? Or is there a way to format the formula to return the difference between the two times in hours and minutes? Or fractions of hours expressed as a two decimal place number? I would like to be able to total the sum of hours and minutes worked in the summary bar as well.

I have searched around a lot, but haven’t found any resources specifying how to get this result with the datetime_diff formula.

Thanks in advance for the help.

Just following up with an additional idea, which seems like it will work for my needs:
DATETIME_DIFF({End Date-Time}, {Start Date-Time}, ‘minutes’) / 60

But I am still curious if there are other ways to specify the format of hours and minutes within the datetime_diff formula.

Thanks! It just did the trick for me.

Following up on this question:

I have 2 date fields: “start” and “stop”. Both in European timezone and 24h time format (“same time zone for all…”). 3th field is a formula field to calculate the difference in hours between start and stop (to register hours for labour workers): “DATETIME_DIFF(Einde,Start,‘HH:mm’)/3600000” (format: “decimal”; 1.00 precision).

Question: if I don’t add the “/360000” it doesn’t return eg 2.5h, but only the full hours (2h or 3h). Why? What am I missing here? Why do we have to use this workaround and how can it be 360000 for 2,5h?

Labels