I’m trying to calculate the time difference between 2 date & times and format them as hours and post that result to thing in the database. But it’s giving me some random number that i’m not sure where it’s coming from (pics below). I used the inspector to see if it’s doing the calculations correct and it is but it’s just not posting to the database correctly. Any help would be appreciated.
bump! also interested in seeing if this is possible
Read the reference about the date interval data type. That’s the data type that results from subtracting one date object from another. They have their own set of operators. (In some other systems, similar objects are called durations.) I Can’t recall is intervals represent seconds or milliseconds, in Bubble, but it’s probably ms.
You might also read this, where I write more about dates and related objects:
I should also mention: my commercial plugin Calendar Grid Pro has a utility function that does a similar operation, but can spit out the duration value in any format.