TF: Format a time span (eg 3 hours ago)

Syntax

tf(date, [format])

Arguments

  • date: Date to be used. The Date can be returned by some other function or you can use text. For text dates you can both set it statically using the format '1955y11M12d22h04m00s' to express year 1955, month 11, day 12 at 22:04:00 (all fields are optional), or use 'a/r' (add/remove) operators, so, for example 'a12m3s' will add 12 minutes and 3 secs to current date.
  • format: Optional format to be used for the time, see examples

Examples

Formula Description
$tf(bi(plugged))$ Time since last battery plugged/unplugged
Midnight $tf(0h0m0sa1d)$ Time to midnight (we first set the time to 0 hours, 0 mins and 0 sec then we add one day at the end)
Midnight in $tf(0h0m0sa1d, hh:mm:ss)$ Countdown to midnight (same as before but we use custom format)
$tf(ai(sunset) - ai(sunrise))$ Current duration of daylight, automatic format
Tonight $tf(ai(sunrise, a1d) - ai(sunset), "h' hours' and m' minutes'")$ of darkness Darkness duration, manual format
Sunrise in $tf(ai(nsunrise), M)$ minutes Minutes till next sunrise
Was this article helpful?
0 out of 0 found this helpful