Dataview: show all files created at the same day and show the result in the daily note

Hey guys,

I have been trying to display my Daily Notes in a way that makes the most sense to me.
I would like to do the following:

  • When I create a new Daily Note, I want to see all the notes in a list that were created on the same day as the date of the Daily Note.
  • My daily notes have the standard date format (YYYY-MM-DD). For example, the daily notes are called (2022-05-01, 2022-05-02, etc.).
  • In all other notes I create, I have a separate field in the YAML called “datecreated”. The date is inserted there in the same format as in the daily notes.
  • Now I would like to have the query with the Dataview Plugin that all Notes are displayed that have the same date in “datecreated” as the File.Name of the Daily Note.

The only thing I have managed to do is to display the notes from today:

list
WHERE file.ctime > date(today)

The problem is that no matter when I create a daily note, e.g. from 2022-05-21, I still only see the notes from today (i.e. 2022-06-16).

Somehow I can’t get it to work and would appreciate any help you can give me.

Best regards

1 Like

Hi @Kalle123, welcome to the Obsidian community!

I think you probably want to use file.cday to identify the file’s creation day, and this.file.day to identify the date in the current file’s title. This query worked for me:

```dataview
LIST
WHERE file.cday = this.file.day
```

If you’re using Windows this should work fine. If you happen to be using Linux, please note that Linux file creation dates aren’t stored the same way, and you may find that you don’t see the notes you expect.

Thank you so much @craig. That worked perfectly well. <3

1 Like

Since you have a datecreated field, if you wanted to, you could use that instead of file.cday:

LIST
WHERE datecreated = this.file.day

But if you’re on an OS where file.cday works, it might be easier to use that and just get rid of your datecreated field.

@scholarInTraining thank you for your answer as well. Works perfect too.

Now i actually want to see all the daily notes in a week note. For this i insert the inline field “week::” in the daily note as well. Is there something similar to “this.file.day” also for week and month?

I would like to list the dailynotes from the week in the week note and all daily notes from a month in a month note.

But i didnt get it. I tried this but wont work:

WHERE week = date(file.cday).weekyear

Thank you

1 Like

@Kalle123

For months:
You can use your already existing datecreated field (or file.cday) and pull the month out of that! Dataview documentation on what you can pull out of a date.

LIST
WHERE date(datecreated).month = this.file.day.month

For weeks: You are on the right track with weekyear!
Weeks are potentially a little more complicated: there are apparently two different numbering systems for weeks depending on how you define the first week of a year. For example, January 1 2022 was a Saturday; what is week 1 for 2022?
Thus I would highly recommend not making your own week field and instead comparing the weekyear fields of two dates, since they’ll be in the same numbering system.

1 Like

Oh man. Thank you soooooo much. Insane how quick your reply was :slight_smile: and it works exactly how i need and want it. Thank you. Made my day :slight_smile:

1 Like