Date difference calculation

Is it possible to calculate the difference - number of days - between two dates?

1 Like

In a text field, you could do: insert dynamic field -> “date 1” “-” insert dynamic field -> “date 2” formatted as days. :slight_smile:


I have tried:

I tried to format each value as +days - but then it shows in red.

I think you would need to use a text element, not an input element. :slight_smile:

Unable to figure it out. I tried various configurations and smart editing protects code changes so you can’t paste it an answer.

Can you share your app so that we can have a look? Or reproduce the situation in the forum_app?

Not sure where forum app is? I was only testing so no problem sharing - again - not sure if this is the right way Day 1 Bubble: or

Hi, I made a quick “Time Difference” app for you on the forum test app.
You could back-engineer it to see how to do it.
The first thing you should know, is how to do “custom states”. Once you know that, it will be easy to work out from the following link…
Time Difference

note: I configured this for “seconds” because it’s easier to test than if it was configured to “days”.


Where is the calculation of total time? It looks like the initial condition simply says:
totalTimeText’s totalTimeState:format as seconds (seconds)

If you go into the workflow tab and look at the “stopButton is clicked” box, you will see the workflow event for TotalTime.

Here’s a screenshot…

1 Like

Yes just found what I was looking for:

Shows I have a lot to learn…

Yep - you got it. Make sure you go through the tutorials, they help a lot.
By the way - I’m just another user like you, I’m not staff or anything.

1 Like

Thank you - I’m certain a lot of people will benefit from your response. You should suggest this as a demo to Bubble. I will as well…


No worries. Thanks for your kind words.

I know this is old but thought I would comment as it seems it has not been answered and may be of use in the future.

For this to work with the minus option you must first add the ‘date 2’ in the dynamic data so it is as follows - “date 2” - " date 1" value:format as days.

1 Like

Kind of random, but for anyone who needs to subtract days with in the same month, the option :extract > date works just fine. That would be “end_date:extract>date - start_date:extract > date”. It works just fine with in the same month.