Datetime_is_same_or_before

Hi guys

I am having trouble with the above mentioned formula. I am using it to generate a different background.

I would really appreciate if a pro could have a look at it, that’s what I was trying but it will give me all the time false even if it is true:

IF(DATETIME_IS_SAME_OR_BEFORE((NOW("DD-MM-YY")), (FORMAT_DATETIME_LOCAL(DATETIME(NUMBER(REPLACE_ALL(REPLACE_ALL(REPLACE_ALL(repeated.current.ValidTo, "/Date", ""), "(",""),")/",""))),"DD.MM.YY"))), "green", "red")

The REPLACE_ALL is needed because I get the date initially like this

/Date(1615479353197)/

Thanks a lot for your help
Andreas


sidenote:
If I am trying the FORMAT_DATETIME_LOCAL as a standalone like this

FORMAT_DATETIME_LOCAL(DATETIME(NUMBER(REPLACE_ALL(REPLACE_ALL(REPLACE_ALL(repeated.current.ValidTo, "/Date", ""), "(",""),")/",""))),"DD.MM.YY")

I am not running into problems, so the issue must be somewhere else

Hi, FORMAT_DATETIME_LOCAL gives you a formatted string, it is not a valid datetime you can put to the DATETIME_IS_SAME_OR_BEFORE formula. So remove that from the 2nd parameter, DATETIME() is enough. Similarly in the 1st parameter you can just use NOW().

2 Likes

That makes sense, thanks a lot @Mari

1 Like