Create a live clock with NOW and REPEAT

One of the cool features of dashdash is the ability to refresh a formula without needing to manually force it.

For this, we have built a cool function, REPEAT(function, interval)!

For a quick demonstration, you can build a clock.

  • The NOW() function gives you the time since the beginning of Epoch, which is the beginning of 1900. It’s also on a per-day basis, that is, the whole units is the day and decimals represent fractions of a day!
  • We will need to subtract the day to get hours, minutes and seconds and convert them the appropriate notation.
  • We will use 24h notation, and minutes of seconds each last 1/60th of the preceding part of the time. Boring. Moving on…

So, let’s built it!

  • The indicators
    • A1: Now (UTC)
    • A2: Day
    • A3: Hour
    • A4: Minute
    • A5: Second
  • The formulas
    • B1 =REPEAT(NOW(),1)
    • B2 =ROUNDDOWN(B1)
    • B3 =ROUNDDOWN((B1-B2)*24)
    • B4 =ROUNDDOWN((B1-B2-B3/24)*24*60)
    • B5 =ROUNDDOWN((B1-B2-B3/24-B4/(24*60))*24*60*60)
    • B7 =B3&":"&B4

The secret sauce is inside cell B1. The REPEAT(NOW(),1) will recalculate NOW() every 60 seconds and update the screen, if you have the application open.

Remember: Even if you don’t have the application open, the clock is refreshing in our servers. This is super useful if you want to make your application do something at a specific time. Say, like sending an SMS. We’ll talk about that later.

54

This is what the application looks like!