Templater - How can I take my file.title and show the date in a different format?

Things I have tried

<% tp.file.title(“DD”) %>
<% moment(tp.file.title,“YYYY-MM-DD”).format(“DD”) %>

What I’m trying to do

My daily note is creates with a name in this dateformat YYYY-MM-DD, and I am happy with that. BUT, I want to show the name as an different format.

When I search on the internet for examples I anly find thing whit today’s day +/-, but that is not helpful in this case.

In this case I+ve already created a daily note in November with the title “2022-11-15”

And now I am trying to make a heading with that date - but with the format (“DD. MMMM YYYY”).

Is there any way I can format the file.title to show another format just in this heading (without renaming the file.title)?

I think you are looking for this string. The heading should use this template to take the date from the file title and change to the new format.

<% tp.date.now(“DD. MMMM YYYY”, 0, tp.file.title, “YYYY-MM-DD”) %>


Thank you for helping. I tried exactly this string: <% tp.date.now(“DD. MMMM YYYY”, 0, tp.file.title, “YYYY-MM-DD”) %> But I only get an error.

Sorry! It totally worked when I just wrote it manually instead of just copy. Thank you!! Haha, I´ve spent hours on this today . So really thanks!

You’re welcome. Glad you got it working.

It seems I have an issue with Templater now as I am getting errors on every template I make. I think the new Obsidian update broke a few things. Looks like Im going to have to re-install.

1 Like

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