Equating Modified() and Today()

I am trying to count using Modified(), but I cannot get Today() and Modified() synced

I have Modified triggered in this code:

if(thisRow.[Next Step]="Complete" or thisRow.[Next Step]="LTFU", thisRow.[Next Step].Modified(), "Pending")

I cannot get the Modified() from the first code to equal Today()

If(thisRow.[Date Completed].Modified()= Today(), 1, 0)

I only get 0’s

How can I get thisRow.[Date Completed].Modified()= Today() --> True?

I believe Modified() returns a datetime, whereas today is merely a date. Try adding .ToDate() to the end of .Modified(), e.g.

If(thisRow.[Date Completed].Modified().ToDate()= Today(), 1, 0)
1 Like

Damn, didn’t work. Trying different variations and still only ending up with 0’s

Try .Modified().DateTimeTruncate("day") instead.

ToDate() may change formatting but not change the actual value, leaving it with “implicit” time part.

Hey @Carson_Townsend this comes down to how dates are handled in Coda (and in ‘coding’) generally.

Each date and each time is actually a ‘date time’ - a value that contains both a date and a time. Coda will allow you to specify a column as a Date type, and it will only show the date, but this can be tricky because the time still is there, albeit hidden.

When using just dates, the time value defaults to 12:00:00 AM or in a sense ‘zero’, the lowest possible value for the time. Today() behaves in this way; when you use that formula it will return a date value with the time as 12:00:00 AM.

Modified() returns a date time as well - the date the row was modified as well as the time.

So when you compare a modified() value to a today() value, unless you modified the row at exactly today at 12:00:00 AM, the values will not match. Good luck!

Disregard my previous comment; both ToDate() and DateTimeTruncate("day") strip time properly.

Is your thisRow.[Date Completed] column an input or a formula? Because it looks like Modified() simply returns blanks for formula columns and would only work for input columns.

Thank you so much everyone! Took everything and stripped Modified, leaving me with

If(thisRow.[Date Completed].ToDate()= Today(), 1, 0)

I hate it when the solution is soooo simple

1 Like