Countdown days until a specified date

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • Answered
So I have two fields: the first is a projected 'delivery date' and the second is a 'how many days until delivery" (essentially, its a countdown).  On the Days-Until-Delivery field I have the following formula:

ToDays([Projected Launch Date] - Today())

And it works great. Problem is, after it reaches the due-date, it starts to show a negative value.  I would like it to simply 'zero' out once the due-date is achieved (I already have it set-up to show any records that are past the due-date to be highlighted in red). Any suggestions on how to code this out?

Thanks in advance for your help.
Photo of Ron

Ron

  • 300 Points 250 badge 2x thumb

Posted 8 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,436 Points 50k badge 2x thumb
if you want a zero, this this will work

Max(ToDays([Projected Launch Date] - Today()),0)

That way it will never go below zero.

But if you want null (blank) then it would be

var number Countdown = ToDays([Projected Launch Date] - Today());

IF($Countdown >0, $Countdown)
Photo of Ron

Ron

  • 300 Points 250 badge 2x thumb
Thanks - I'm really glad that I asked, since my solutions were not even close to what you have there (and also why they weren't working!).  I do like the idea of the null, so I appreciate that suggestion, as well.