I created a field named ‘Duration’ with data type ‘date interval’ in my database. I understand this data type stores milliseconds as integers? Why cant I save an input set to a number in my workflow into the field?
Hi @rhea ,
Bubble wants you to format your value as the difference between two dates rather than a straight integer. So, you can do something like “Date A minus Date B”, but not “Date A minus Date B: formatted as days”
The screenshot above shows a properly formatted expression: Current date/time minus another date, which in this case happens to be the record’s creation date.
It’s a little confusing, but yes, if you go to App Data and open up the record, you’ll see this value is represented in milliseconds and you can even edit the number here!
However, when you’re looking at it from the table view, Bubble will transform it to a more “human friendly” format if the difference between the dates is big:
That table display is just Bubble doing a conversion for you to make it easier to read just how technically dates and times are saved in UNIX format (timezone-less) but converts it to your timezone so it’s relevant to you.
This “date interval” field is helpful if you need Bubble to calculate the difference for you, but you might also want to consider having normal number fields instead and doing the calculation in your designs instead. You might get a bit more flexibility that way.
Hope this helps!
–
Cheers, Gaby
Co-Founder at Coaching No Code Apps
Free Bubble Masterclass
Private Help
Wow Gaby, thank you for a very informative answer! Very helpful. I was kind of guessing it should be a difference between dates, but couldn’t nail down the syntax. Again, thank you!
This topic was automatically closed after 70 days. New replies are no longer allowed.