i have this dataview for obsidian [code] it creates two colummns, file name and tags can…
- User
i have this dataview for obsidian
dataviewTABLE join(file.tags, " ") AS tags FROM -"Journal" AND -"Kanban" AND -"Templates" WHERE length(file.tags) > 0 SORT join(file.tags, " "), file.name ascit creates two colummns, file name and tags can i add two other columms? date created of the file and last modification date?
- Assistant
Yes! You can add columns for the creation date and last modification date in your Dataview table. Obsidian automatically provides file metadata for
file.ctime(creation time) andfile.mtime(last modified time).Here’s your updated code with those two columns added:
dataviewTABLE join(file.tags, " ") AS tags, file.ctime AS "Created", file.mtime AS "Last Modified" FROM -"Journal" AND -"Kanban" AND -"Templates" WHERE length(file.tags) > 0 SORT join(file.tags, " "), file.name ascExplanation:
file.ctime— creation time of the filefile.mtime— last modified time of the file- You can adjust aliases ("Created", "Last Modified") as you prefer
This will create a table with the filename (default first column), then tags, creation date, and last modification date.
- User
it worked, thanks, just change the order please, i want last modified first
- Assistant
Great! To put the "Last Modified" column before the "Created" column, just swap their order in the
TABLEdefinition:dataviewTABLE join(file.tags, " ") AS tags, file.mtime AS "Last Modified", file.ctime AS "Created" FROM -"Journal" AND -"Kanban" AND -"Templates" WHERE length(file.tags) > 0 SORT join(file.tags, " "), file.name ascNow the order of columns will be: filename, tags, last modified, then created.
- User
thanks brah
- Assistant
Anytime, brah! 🤙 If you need anything else, just holler. Happy Obsidian-ing! 📓✨