Mar 03, 2020 01:28 PM
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.
Mar 03, 2020 02:28 PM
I think it’s because you are using Duration instead of DateTime
Mar 03, 2020 02:30 PM
@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
Mar 03, 2020 09:04 PM
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
?
Mar 04, 2020 03:02 PM
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.