PSA: Replace Now() with a lower-resolution real time clock for heavy formulas

UPD: For anyone finding this trick in 2023 and beyond — don’t use it anymore!

Use Now() with precision, e.g. Now("minute") or Now("hour").

For the record, there are two hidden functions, NowInMinutes() and NowInHours() but the officially supported one is Now() with an argument.


Sometimes you need to calculate things based on current time (e.g. conditionally format tasks that are due, or show different text values for when the time is in the past or in the future). And sometimes those calculations are quite heavy.

What to do when you don’t need the precision of Now() (which updates and triggers recalculations a few times per second), but Today() is too coarse too?

Answer: make a less granular counter and depend on that. E.g., for minute-precision make a named formula DateTimeTruncate(Now(), "minute")

Coda will recalculate this formula every time Now() changes (i.e. multiple times a second), BUT will not recalculate anything depending on this coarse timer as long as its [cached] value stays the same (i.e. for the entirety of a minute):

14 Likes

Using the named formula is really clever, thanks @Paul_Danyliuk! I’ve been struggling with this for a couple of hours now and am looking forward to my doc running smoothly again!

1 Like