Get modified date in dataview

What I’m trying to do

Hello friends, i’m trying to get modified date of each file linking to this file (i call this file as Home)

  • Dataview:
TABLE filter(file.inlinks, (o) => !contains(o.file.folder, "Calendar/Journal")) as "Links", file.inlinks.Status as "Status"
FROM [[Home]]
SORT file.name ASC
  • This dataview code will get all file (except file from journal) linking to Home and get “Status” properties in each file

Things I have tried

TABLE filter(file.inlinks, (o) => !contains(o.file.folder, "Calendar/Journal")) as "Links", file.inlinks.Status as "Status", dateformat(file.inlinks.mtime, "dd.MM.yyyy - HH:mm") AS "Last modified" 
FROM [[Home]]
SORT file.name ASC
  • I have tried add file.inlinks.mtime and file.inlinks but it simply can’t work, it seam that dataview understand file.inlinks.mtime is a created properties by me and not modified date

  • Sorry for any confusion in my english

dateformat(file.mtime,"dd.MM.yyyy - HH:mm") as "Last Modified"

Hello, thank you for replied. I’m sorry for confusion, i meant getting “Modified date” from file.inlinks, meaning below dataview code can be explained as following.

  • Firstly dataview will get any file link to [[Home]] and output in the first column;
  • Secondly “filter” is getting all file exclude from folder “Calendar/Journal” that link to the file linked to [[Home]], e.g: if file A link to [[Home]] and B, C link to A, second column will have file B and C;
  • Lastly file.inlinks.Status will get value from Status:: in each file e.g B and C.
TABLE filter(file.inlinks, (o) => !contains(o.file.folder, "Calendar/Journal")) as "Links", file.inlinks.Status as "Status"
FROM [[Home]]
SORT file.name ASC
  • What i’m trying to do is getting file.mtime from file B and C. Resolution you gave me only get modified time from file A
  • I have tried file.inlinks.mtime as i though it the same as file.inlinks.Status but it didn’t work

I am so sorry I did not read the question carefully, and I come up with something despite having absolutely no clue why this works.

Edit: Misread again, pain.

table 
	rows.links as "Links", 
	dateformat(rows.links.file.mtime,"dd.MM.yyyy - HH:mm") as "Modified Time"
from [[Home]] 
flatten file.inlinks as links
where !contains(links.file.folder, "Calender/Journal")
group by file.link
sort file.name asc

Let us review a slightly simplified version of your attempt:

```dataviewjs
TABLE
  filter(file.inlinks, (o) => !contains(o.file.folder, "Calendar/Journal")) as "Links",
  file.inlinks.Status as "Status",  
  dateformat(file.inlinks.mtime, "dd.MM.yyyy - HH:mm") AS "Last modified" 
FROM [[Home]]
```

I’m assuming that your intention is for the second and third column to only use the inlinks filtered in the first column. This will not happen. The second and third column will pick from the entire list of inlinks for that particular file.

Furthermore, since dateformat() accepts a single date, not a list of dates, it’ll fail to. So to get the full list of mtime’s formatted, you need to map each value by itself. Also, to get the file specified mtime you need to do file.mtime, and not just .mtime. If you have actually specified the modified time in a property called myMtime, you could use .myMtime.

So here is a revised query which displays the file modification time for each of the filtered inlinks to each file:

```dataview
TABLE Links, 
  Links.Status as "Status",  
  map(Links, (l) => dateformat(l.file.mtime, "dd.MM.yyyy - HH:mm")) AS "Last modified" 
FROM [[Home]]
FLATTEN list(filter(file.inlinks, (o) => !contains(o.file.folder, "Calendar/Journal"))) as Links
SORT file.name ASC
```