Forum Academy Marketplace Showcase Pricing Features

Calculate 'time passed' based on 'latest activity'

Hi team,

Been pulling my hair out on a ‘time passed since’ feature. Can’t seem to find anything on the forum - perhaps I’m missing something quite straight forward…

I’m building a forum and am looking to display the amount of time that has passed since a discussions’ latest activity.

  1. How would I make this calculation? I’ve captured discussions’ ‘latest activity’ timestamp, but have no idea how to count the time from there until the present.

  2. How do I display this ‘time passed’ based on the below conditions?

If < 60 m, in minutes
If >60 m and < 24 h, in hours
If > 24 h, in days

I’m looking to mimic what Bubble does in it’s forum:

Grateful for any thoughts that can point me in the right direction!

You can use the time stamp and then subtract the current date/time and format as a days if it is days that have past…you could also format it just as a number to show if it is minutes.

Here is a screen shot from my set up for messages

Screen Shot 2020-08-10 at 12.01.09 AM

Note: I used the *-1 because I put the times in wrong order to start and was too lazy to change it all so I just multiplied by -1 to turn the negative to positive.

1 Like

Ahhh man that’s brilliant! Would have never worked this out on my own… Thanks so much for taking the time, you made my day.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.