When you subtract dates in Bubble, you get a date interval (measured in milliseconds), but the built-in formatting options don’t directly give you HH:MM format.
The Solution:
You’ll need to use mathematical operators to convert the date interval into hours and minutes:
Calculate Hours: Use Date difference :formatted as hours to get the total hours
Calculate Minutes: Use Date difference :formatted as minutes and then use the modulo operator (%) with 60 to get remaining minutes
Format as Text: Combine these in a text element like: Hours & ":" & Minutes
Example Expression:
In your text element, you could use something like:
Current date/time - Other date :formatted as hours & ":" & (Current date/time - Other date :formatted as minutes % 60)
Important Note:
Once you format a date using :formatted as, it becomes text and can no longer be manipulated as a date. That’s why we use the mathematical approach instead.
This approach gives you the precise HH:MM format you’re looking for while working within Bubble’s date handling system!