Calculate how long ago

In a text field I’m trying to calculate how long ago a Created Date for a thing was from NOW. If less than 24 hours ago I’d like it to show hours (rounded), and if greater than 24 hours to show the actual date entered. I looked in the forum but didn’t find a discussion for this. Maybe I was using wrong search terms. Can this be done?


1 Like

Hi @gnelson,

Try this for under 24 hrs…


And this for over 24 hrs…



@gnelson you might want to also take a look at @louisadekoya’s really helpful Moment.js plugin here:

It saves you from having to set a custom state for the current date and time, a workflow which updates that custom state time every second, and then the conditional formatting statements. This is because if you use Current date/time in the expression - it will be the time when the page was first loaded for that User. With this plugin, the current time that you are comparing with the Thing’s date is basically in real-time (it can be updated after a couple milliseconds, which you can customize as well). :slight_smile:


Thanks Gaby. Sorry for being so slow to respond. This works. The next one is easier. LOL

Thanks @fayewatson. Sorry for being so slow to respond. Got sidetracked.

1 Like

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