Dataview queries to show notes created 6 months ago, 1 year ago, 5 years ago

What I’m trying to do

I’d like to have a section in my daily note that uses dataview queries to show me the daily notes I created 6 months ago, 1 year ago, and 5 years go.

I have a property “date” in my template, example:
date: 2023-11-13
Or I suppose I could use the file creation date automatic property.

Not getting any results.

Things I have tried

Here’s what I’m trying for the 6-month query:

TABLE mood
FROM "Daily archive"
WHERE date AND date <= date(today) - dur(6 months) AND date >= date(today) - dur(6 months 7 days)
SORT date DESC
LIMIT 25

Hmm… THe following query functions just fine in my setup:

```dataview
TABLE file.day, date
WHERE file.day
  AND file.day <= date(today) - dur(6 months)
  AND file.day >= date(today) - dur(6 months 7 days) 
SORT file.day desc
```

The file.day will pick its date from either the file title, or from the date field/property.

So I’d suggest doing that query, and see what kind of results you get. It should work with current version of Obsidian and dataview.

Which versions of either are you using? And can you show an example of a note with a proper definition of date ?

Thanks, worked like a charm!

Closing the loop, my daily note template has this property, filled-in by Templates.

date: {{date:YYYY-MM-DD}}

Example from today’s note:
date: 2023-11-13

This is Obsidian 1.4.16 on iPad
I also have it on my Mac, should be the same or newer version.
Dataview is 0.5.53.

Thanks again!

You should consider updating dataview, as it’s now in version 0.5.64. Don’t forget to update your plugins every now and then.

1 Like

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