Getting Days Since Modification Date as Integer for Calculation?

What I’m trying to do

I’m trying to get the days since the last modification of a file as an integer so that I can use it as part of a calculation in a table.

Is this even possible with Dataview?

Show us some of what you’ve tried? This will also show us what we’re working with.

1 Like

Sounds like something I just found an example of last night while reading through some old posts. It’s a dataviewjs block that shows the file name, creation date, and days since the last change, a perfect setup for keeping track of an “Inbox” folder:

var format = dv.current().dateformat || 'yyyy-MM-dd';
var locale = dv.current().locale || 'en';
dv.table(
	['Note', 'Created', 'Last change'], 
	dv.pages()
		.where(p => p.file.name != dv.current().file.name
			&& p.file.folder.includes("_Inbox"))
		.sort(p => p.file.mtime, 'desc')
		.map(p => [
			p.file.link,
			p.file.ctime.setLocale(locale).toFormat(format),
			p.file.mtime.toRelative({locale:locale,unit:'days'})
		])
)

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