Auto updated creation/modification date with templater?

Hi there.
I am using templater plugins but I have problem with auto-update meta like creation and modification. I always when I create or edit notes, I have to cmd + P and choose option Insert Current Date, I always forget about it.

How can I set auto-updated notes in meta (create/edit date)?
Maybe I should change the plugin?

There’s the “Update time on edit” community plugin.

2 Likes

@CawlinTeffid thanks, but how I can use it?
https://drive.google.com/file/d/1qbOVaeY6AmNWEYa9Rl70RqfL3Cn2_7Ya/view?usp=sharing

Would this work for your needs?

**Created**: `=dateformat(this.file.ctime, "yyyy-MM-dd-EEEE, HH:mm")`   
**Modified**: `=dateformat(this.file.mtime, "yyyy-MM-dd-EEEE, HH:mm")`   
**Location**: `=this.file.path`   
1 Like

@anon63144152 how I can put it to meta?

---
**Created**: `=dateformat(this.file.ctime, "yyyy-MM-dd-EEEE, HH:mm")`   
**Modified**: `=dateformat(this.file.mtime, "yyyy-MM-dd-EEEE, HH:mm")`   
**Location**: `=this.file.path`   
---

Not working

As a YAML header at the top of the file it won‘t work, although changes to how YAML works are in the pipeline, so things might be different before too long.

You could use it is a folded callout:

> [!NOTE]- Meta
> **Created**: `=dateformat(this.file.ctime, "yyyy-MM-dd-EEEE, HH:mm")`  
> **Modified**: `=dateformat(this.file.mtime, "yyyy-MM-dd-EEEE, HH:mm")`  
> **Location**: `=this.file.path`  

Or hide it in reading mode as commented text:

%%
**Created**: `=dateformat(this.file.ctime, "yyyy-MM-dd-EEEE, HH:mm")`  
**Modified**: `=dateformat(this.file.mtime, "yyyy-MM-dd-EEEE, HH:mm")`  
**Location**: `=this.file.path`  
%%

I don’t know, I haven’t used it. Did you read the plugin description page? Those usually have some instructions.

Tepmplater’s dynamic commands deprecated soon(?)

Tepmplater’s dynamic commands <%+ ... %> are not working reliably anymore and might be deprecated soon. In short <%+ ....%> does return NaN instead of needed values like date.


Alternative way for automatically updating yaml

For quickly generating and/or updating yaml /front matter block I now use reasonable alternative, that is community plugin Linter.
Linter has YAML section that can be configured to create, format and update yaml block.
I use it to auto-generate yaml atr. like title, aliases, tags and created / modified dates.

Advantage

  • values are edited into note itself as text instead of script so *.md file can be read outside of obsidian.
  • unifies format in all notes

Disadvantage

  • single format for all notes

Automation

Once set up, Linter can be triggered either by shortcut ctrl + alt + L (as in many IDE’s) or automatically upon saving.


Linter

It is a “prettyfier” plugin. among updating yaml it’s primary function is to format md file according to setting and/or md standards.


Disclaimer

I’m not associated with Linter team. I simply looked for way to fix Templator’s “NaN” issue and came across this thread and after finding alternative came back to help fellowship of obsidian in the future.

1 Like