DataView table to show each day a file was modified

What I’m trying to do

Create a Dataview Table which displays all files that have been modified today.
I am purposely NOT using file.mtime because I want to know each day the file has been modified.

I am using the “Update modified date” community plugin which is working beautifully.
It’s adding the date, each time a file is modified, when it does so, it looks like this, in the properties or frontmatter:

– 2023-11-26
– 2023-11-29

“Modified” is a property, set with the “Date” property type.

As I edit the file, the plugin keeps appending to this list, with a new date. It’s great!

The problem I have, is because I’m working with a list, or multiple entries to the “Modified” property, dataview isn’t finding any results.

If I switch off the feature within the community plugin “Update modified date” which appends the Modified date, and instead replaces the exisiting date with the most recent date, the Modified property looks like this:

Modified: 2023-11-29

When I configure it this way, my data view table works!
But when the dates are like this:
– 2023-11-28

It doesn’t work.

Things I have tried

The code I am using in my Data View is as follows:

``` dataview
TABLE modified, updated as tags, type, status
FROM "" AND !"Journal" AND !"Templates"
WHERE dateformat(Modified, "YYYY-MM-dd") = dateformat(date(2023-11-29), "YYYY-MM-dd")

It’s almost as if I have to get data view to ignore the fact that the date is presented in the Modified property with a - in front of it.

If I understand you correctly, then the following WHERE clause should work:

WHERE contains(Modified, dateformat(date(2023-11-29), "YYYY-MM-dd"))
1 Like

I very much appreciate your reply, and a speedy one at that!

However, unfortunately this doesn’t work. In fact when I use your provided code, my table doesn’t work at all.
Even when the Modified property displays like:

Modified: 2023-11-29

Whereas, with my code, the above works fine.

It only breaks when it’s like this:

– 2023-11-29

It’s almost as if when the Modified property is like the first example, it’s being treated as a date. And when it’s like the second example, it’s being treated as text or something.

However, what’s interesting is that the property still successfully shows it as a date in the “properties editor”, irrespective of it being the first or second examples shared above.
Obsidian doesn’t care. Dataview does, seemingly. Frustratingly.

I kind of anticipated that, so then try this one which should join up both the single value and list value variants:

WHERE contains(flat(list(Modified)), dateformat(date(2023-11-29), "YYYY-MM-dd"))

That trickery of flat(list( ... )) ensures that we’re getting a list out of the input property regardless of it being a single value or a list of values. This then reenables us to use list functions, like contains() & co on the property.

PS! Still untested as I’m kind of busy… It it still doesn’t work I’m going to do some testing later on… :smiley:

1 Like

Again, really appreciated your thoughts on this, but unfortunately this hasn’t worked either.

When using this code, as before, I get no results for the Modified property showing the date in a list or as a single date. Unlike my code which is working for the single entry.

In the research I did, I came across contains and even flat, so I feel like you’re on the right path…

Thanks again, you’re a legend for helping me here

I goofed up a little. You can’t compare a date with a string and expect them to match… So if you do contains(flat(list( Modified )), date("2023-11-29")) we’re comparing dates with dates. (And this time I tested it… :smiley: )

1 Like

Perfect! Worked well… I also adapted it to use the name of the file, to inform what day to consider, as this code is going into my Daily Journal.

Here’s the finished code I’m using for anyone else that may find this thread and want help:

Notes Created & Modified Today


TABLE type, status
FROM "" AND !"Journal" AND !"Templates"
WHERE contains(dateformat(file.ctime, "YYYY-MM-dd"), dateformat(, "YYYY-MM-dd" ))


TABLE type, status
FROM "" AND !"Journal" AND !"Reference"
WHERE contains(flat(list( Modified )),

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.