Past, current and future date

I’m trying to make a calendar widget, so I need formula to change color depending on if date is past, current or future

Hi there,

Here’s a quick tip on checking today’s date against past and future dates.

Set the following code snippet as the Color value in the Paint tab of the element you want to custom its color.

Code snippet to check the date 2025-01-19 against today:

$if(
  dp(2025y01M19d0h0m0s)-
  dp(0h0m0s)<0, "#999999",
  dp(2025y01M19d0h0m0s)-
  dp(0h0m0s)>0, "#CCCCCC",
  "#000000"
)$

• If the date difference is < 0, it’s in the past so the color will be #999999 (dark gray).
• If the date difference is > 0, it’s in the future so the color will be #CCCCCC (light gray).
• If the date difference is = 0, it’s today so the color will be #000000 (black).

I hope this would help.
:smiling_face::+1:

1 Like