List of all Notes created Today in Daily Note

What I’m trying to do

Every Note (including the Daily Notes) in my Vault contains a YAML Header of the Form

First Created: DD.MM.YYYY dddd HH:mm:ss
Last Modified: DD.MM.YYYY dddd HH:mm:ss

I want to create a Dataview Table in my Daily Notes Template, so that each daily Note displays

  1. Each Note I created today
  2. Each Note I modified today

My best guess would be to match the Date (excluding the time) of every Note’s YAML Header to the daily Note’s YAML Header.

So far I’ve cobbled this together:

WHERE"First Created", /\d{2}\.\d{2}\.\d{4}/), "DD.MM.YYYY") ="First Created", /\d{2}\.\d{2}\.\d{4}/), "DD.MM.YYYY")
  AND !=
SORT file.creation_time ASC

But that returns the Error
Expected:variable identifier

What am I missing?

Kind Regards,

You are getting the error because you are referring to a templater variable in a dataview code block without using the proper templater syntax.

This is an excerpt from my daily note template:

> [!example]- Today’s Notes
> ```dataview
> table without id
> as Note,
> file.folder as Folder,
> file.mtime as "Last Modified"
> FROM -"Daily Notes"
> where file.mtime >= date(<%tp.file.title%>) AND file.mtime <= date(<%moment(tp.file.title,'YYYY-MM-DD').add(1, 'd').format("YYYY-MM-DD")%>)
> sort file.mtime desc
> ```

I don’t know if it will do exactly what you want, but it might help you start.

1 Like

This is what I use for a modified today file list in my daily notes. Change file.mtime to file.ctime to get created files.

Table dateformat(file.mtime, "yyyy-MM-dd HH:mm") AS "Last Modified"
FROM "" AND -"Daily Notes"
AND file.mtime.month =
SORT file.mtime desc

I was just thinking way too complicated.

WHERE file.path != this.file.path 
file.cday = this.file.cday 
file.mday = this.file.cday

completely did what I was looking for. That gives me a List that displays in each daily note all of the other notes that were created or modified on the date of that daily note.

1 Like

I do the same thing - with the added tweak of putting it all in a closed callout so I only see all that info if I want to.

>[!EXAMPLE]- Files Added and Modified Today
>### New Today 
>WHERE file.cday = 
>AND file.path != this.file.path
>SORT asc
>### Modified Today 
>WHERE file.mday = 
>AND file.path != this.file.path
>SORT asc
1 Like

So you seem to have found a solution you like using file.cday and/or file.mday, but I would just like to showcase some new functionality within dataview which actually is capable of handling that custom date format of yours, and transform that into a date known by dataview.

My test file had the following content:

First Created: 07.06.2023 Wednesday 18:53:50
Last Modified: 07.06.2023 Wednesday 18:56:52

TABLE WITHOUT ID row["First Created"], firstDate, dateformat(firstDate, "yyyy-MM-dd")
FLATTEN row["First Created"] as first
FLATTEN date(first, "dd.MM.yyyy cccc HH:mm:ss") as firstDate
WHERE file = this.file

With this query the output was:

In other words, if you’re using date(datestring, formatstring) you can parse a text version of a date, according to the specificed formatstring. Do however note that this formatstring uses Luxon datetokens, and not moment datetokens.

So the moment variant of DD.MM.YYYY dddd HH:mm:ss is equivalent to the luxon variant of dd.MM.yyyy cccc HH:mm:ss. This is confusing, but still having the ability to use date(datestring, formatstring) to get a proper date is a very interesting prospect of ver 0.5.56 of Dataview.

In summary, since v0.5.56 we can convert text version of dates using this new variant of date() (using Luxon tokens), to make dates that Dataview understands. However, it’ll usually still would be better to use ISO8601 format, that is YYYY-MM-DD, to help the date handling in multiple of the plugins of Obsidian.

>[!example]- Files created today
>TABLE without ID status as Status, class as Class, as File
>WHERE file.cday = date(this.date_created) and class !="daily-note"
>SORT file.ctime desc

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