Calculate now()-date, including hours?

I have a field with date and time (date_time), I want a formula for a new column that shows now()-date_time, or elapsed time since date_time.
I have no problem writing a formula that generates rounded up number of days, but I can’t figure out how to write a formula that shows hours instead of rounding up.
For instance, If I am calculating date between now July 8, 2022 at 9 am and July 6 at 1 pm.
I am using formula NetWorkingDays(thisRow.[date_time],now()) and get value 3.
My goal is to get value not rounded up, so 2.66 or 2 days 4 hours or something else that gives some indication of the incremental value of hours or percent of day.
Any thoughts?
Many thanks!

Hi @Gregg_Stebben,

you can simply put the formula Duration(Now() - thisRow.[date_time]) in a Duration datatype column, so that you can set the duration options as you prefer.

However, take into account that Now() (without parameters) is evaluated every second, so it might affect significantly your doc performance.
Consider having a less granular interval - such as Now("minute") or Now("hour").
Alternatively, you can set the value via a button triggered either manually or via Automation.

I hope this helps.
Cheers!

3 Likes

Oh thanks @Frederico

I discover one more tip thanks to you ^^.

I was using Now().ToTime() to remove the date and keep the time but the seconds were bothering me until now :slight_smile: so it becomes Now(“minute”).ToTime().

I just need a trick to convert it to 24h00 format ^^

Sincerely,

Thierry

1 Like