🔔

Days And Hours Remaining

Master Tag
Tips & Tricks
Created
Sep 7, 2020 12:49 PM
Usage
Web Tags
Database
Formula
Cover
Time Remaining
Name
Deadline
Formula
Oct 3, 2020
‣
‣
‣
‣
Oct 22, 2020

Formula (Days + Hours)

if(contains(formatDate(prop("Deadline"), "MMM DD, YYYY"), formatDate(now(), "MMM DD, YYYY")) and hour(prop("Deadline")) == 0, "🔔Today", if(contains(formatDate(prop("Deadline"), "MMM DD, YYYY"), formatDate(now(), "MMM DD, YYYY")) and hour(prop("Deadline")) > hour(now()), "🔔" + format(ceil(dateBetween(prop("Deadline"), now(), "hours"))) + "H : " + format(dateBetween(prop("Deadline"), now(), "minutes") % 60) + "M", if(prop("Deadline") > now() and hour(prop("Deadline")) == 0, format(ceil(dateBetween(prop("Deadline"), now(), "hours") / 24)) + "D ▶︎", if(prop("Deadline") > now(), concat(format(floor(dateBetween(prop("Deadline"), now(), "hours") / 24)), "D : ", format(ceil(dateBetween(prop("Deadline"), now(), "hours") % 24)), "H ▶︎"), if(formatDate(prop("Deadline"), "MMM DD, YYYY") < formatDate(now(), "MMM DD, YYYY"), "◀︎ " + format(abs(floor(dateBetween(prop("Deadline"), now(), "hours") / 24))) + "D", "🔔Earlier")))))

Conditions

(Breakdown of above formula)
*These conditions are formatted to work alone if you want to grab them individually

If today without time, return today

if(contains(formatDate(prop("Deadline"), "MMM DD, YYYY"), formatDate(now(), "MMM DD, YYYY")) and hour(prop("Deadline")) == 0, "🔔Today", "")

If within today and in the future, return hours + minutes remaining

if(contains(formatDate(prop("Deadline"), "MMM DD, YYYY"), formatDate(now(), "MMM DD, YYYY")) and hour(prop("Deadline")) > hour(now()), "🔔" + format(ceil(dateBetween(prop("Deadline"), now(), "hours"))) + "H : " + format(dateBetween(prop("Deadline"), now(), "minutes") % 60) + "M", "")

If future without time, return days remaining

if(prop("Deadline") > now() and hour(prop("Deadline")) == 0, format(ceil(dateBetween(prop("Deadline"), now(), "hours") / 24)) + "D ▶︎", "")

If future with time, return days + hours remaining

if(prop("Deadline") > now(), concat(format(floor(dateBetween(prop("Deadline"), now(), "hours") / 24)), "D : ", format(ceil(dateBetween(prop("Deadline"), now(), "hours") % 24)), "H ▶︎"), "")

If past ≤ -1 day, return days past

if(formatDate(prop("Deadline"), "MMM DD, YYYY") < formatDate(now(), "MMM DD, YYYY"), "◀︎ " + format(abs(floor(dateBetween(prop("Deadline"), now(), "hours") / 24))) + "D", "")

False Condition

"🔔Earlier"