Help

Re: Datetime_diff in minutes not working for me

1513 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Rob_Moya
4 - Data Explorer
4 - Data Explorer

I’m trying to use the DATETIME_DIFF formula to calculate the minutes between one datestamp and another, but don’t seem to be working, help ?

This is my formula
DATETIME_DIFF({Grupo 1 Tiempo de llegada de las bebidas},{Grupo 1 Tiempo de llegada},“minutes”)

Basically is taking the second datetime (17:35), then the second datetime (17:30), and selecting to display the difference in minutes, but it always throws me zero time difference between both.

image

4 Replies 4
Seamus_Campbell
5 - Automation Enthusiast
5 - Automation Enthusiast

I think it’s because you are using Duration instead of DateTime

Zollie
10 - Mercury
10 - Mercury

@Seamus_Campbell is right. It seems to be a type related issue (using a duration for a function that requires a date instead). Disappointing that DATETIME_DIFF isn’t cross-compatible.

You can do the subtraction without DATETIME_DIFF though.

{Grupo 1 Tiempo de llegada de las bebidas} - {Grupo 1 Tiempo de llegada}

That’ll give you a number in seconds, which you could then convert to minutes by dividing by 60. So:

({Grupo 1 Tiempo de llegada de las bebidas} - {Grupo 1 Tiempo de llegada})/60

Rob_Moya
4 - Data Explorer
4 - Data Explorer

Thanks guys! , now I have another issue, I need to set up the difference in minutes, and it seems that with the DATE type of field, I cannot add a Date with the Hour and minutes, what I’m aiming to do is to set up two fields with a Time in minutes, eg: 8:20 and 8:25, and then calculate the difference in minutes between both of them. The DATE type of field doesn’t allow me to add minutes, only day and hours in a 24 or 12 hour format. Is there a way to add a field like 8:20 am ?

Hey Rob - I wasn’t suggesting you replace the Duration fields with Dates fields. You should keep them as Durations and perform the subtraction yourself (instead of using DATETIME_DIFF). The formula I provided does excactly what you’re describing - it’s a difference between two durations in minutes.