I have Daily Notes which are titled (e.g. for today) 2024-01-17
I use a Dataview query to list certain notes that relate to today or the last 24 hours. i.e.
WHERE file m.time = date(today) - dur(1day)
But when I go back a few days, of course (today) in the query is still 2024-01-17 and not the earlier date.
So I need an expression I can use instead of (today) which is the date (title?) of the Daily Note
Things I have tried
Things like {title}… but while this might have been lucky, it would never be fruitful. So I’m asking for advice on what an appropriate search expression – in place of (today) – would be, that would reflect the date of the Daily Note the expression was in.
When you’ve got a proper date in the file title, or in the date property, you can get this date using file.day. So you should be able to change date(today) with just file.day. Or possibly this.file.day if you want to use the date of the current file.
I have tried this on a past Daily Note with the title 2024-01-10. It already has a link to a file where I have added the property created_date: 2024-01-10 but the test is whether Dataview will pull it in.
```dataview
LIST
FROM #faith-fragment AND #incomplete
WHERE file.ctime = this.file.day
```
with variants
WHERE file.ctime = file.day
and
WHERE date = this.file.day.
Another approach, to test the validity of the time part of the query was this:
LIST file.day WHERE file.day
SORT DESC
LIMIT 5
It brought up a lot of results but none on the day of that Daily Note.
I have studied the Dataview document and examples, with more patience than skill, but I would appreciate a steer on this desire to Dataview documents created on the same date as the Daily Note when a previous Daily Note is opened.
```dataview
Table file.mday, file.day
WHERE file.mday > this.file.day
```
I made an example for you. Copy this folder in your root vault: Daily.zip (930 Bytes)
Also you can test the output of the different date formats by copying something like this (I grabbed the trick from another post but don-t remember who was the authorhere’s the post):
Double check that you have a proper date in your title. Did you copy to your vault the example I made for you? that works as you asked. I just tested it:
Just to take the conversation a little further, I would like to create a query that would list EVERY file created or modified on a particular day.
If I leave out the FROM “folder name” or just FROM “” I get everything!
This is relying on implicit creation and modified dates. I accept I may have to add these properties in YAML for my whole vault although I understood that Dataview would find the implicit data.
What is your date format? It seems like you’ve possibly mixed the Luxon tokens with the moment.js tokens, so how have you defined your date format in Settings > Dataview > View settings > Date Format ?
For the benefit of others, here’s what worked for me to create a list of notes created on the day of the Daily Note, and those modified on the day of the Daily Note.
This overcomes the overlap between Created Date and Modified Date — if you need to make the distinction and show modified ior edited notes in their own list:
#### Notes created today
```dataview
LIST
WHERE file.cday = this.file.day
```
#### Notes modified today
```dataview
LIST
WHERE file.mday = this.file.day WHERE file.mday !=file.cday
```