Time + date in Note title

I have tried using templater, filename heading sync, and kanban together. I was able to get obsidian to put the date in the title (using daily notes) but it’s impossible to create a new note with the current time in the header, I’ve tried using macros, scripts, .js, cmd prompt echo commands, nothing is working.

All i wanted was something i thought should be extremely simple, but it is driving me up a wall because every guide or video i see are years old and do not work. I have copied multiple “codes” , i’ve tried setting hotkeys what am i doing wrong?

I’ve tried looking at the context of the coding, which i have 0 knowledge of any type of coding or programming, and i understand the syntax it’s asking for it just never works.

I do things like {{time}} {{date}}

I’ve used…

<%* if (moment(tp.file.title).format("ddd") == "Mo.") { %>
# Montag, <%tp.file.title%>
<< [[<%moment(tp.file.title).add(-1, 'd').format("YYYY-MM-DD")%>]] | [[<%moment(tp.file.title).add(1, 'd').format("YYYY-MM-DD")%>]] >>

I had a nice template going where it would create sytem prompts for filling in several data fields, but the one thing I need is for it to create a note with the time stamp.

I don’t understand why obsidian even has a “open next daily note” or whatever similar feature it is if it doesn’t work like you’d think. I know it’s supposed to be the “note for today” but it’s really weird that I can’t just easily add the time to the title without obsidian freaking out about syntax and improper code, illegal characters, etc…

I want to be able to make notes like

Note “{{MMMM-DD-YYYY HH:MM a}}”
So…
Note June 15, 2022 2:00am
Note June 16, 2022 1:15pm
Note June 16, 2022 1:17pm
Note June 16, 2022 1:34pm

I no longer have my original template because some settings I was changing after looking from video to video, guide to guide where nobody ever has the right answer, and everything I spent hours setting up is gone somehow.

Please help.

If someone has the code for making time show up in title with date, please let me know.

this isn’t an issue of me not knowing the syntax, the guides are all just terrible.

4 Likes

If you are on Windows, it does not allow the use of colons in file names. That is what Obsidian is calling illegal characters.

I use the following Templater snippet in my templates.

<% tp.file.rename(tp.date.now("DD.MMMM.YYYY-HH.mm.ss")) %>

To get it as a heading, remove tp.file.rename.

Also, in my experience, it is not necessary to add moment into the syntax. If it is not working, the console will usually print an error message. CTRL + Shift + I will open the the console.

4 Likes

how do I apply that/where?

I’ve changed so many settings, I work IT so I’d like to know I’m not a complete idiot but even after working through guides and youtube videos nothing is “clicking” and one thing someone tells me to do never works.

I have templater installed and system command functions on, no matter how i enter this it doesn’t work.

I’ve had people say to put the code in a not under templates folder, create a script folder and put it in there, put it under the shell binary location, and put it in the “user function n*1” box.

all of the top youtube videos are absolute garbage and most of them just show installing it from the website, are there any…actually good guides that won’t make me want to roblox myself more than I already do after trying to get 1 thing…the time…in the title.

I understand that the colons are illegal characters, i was using dashes and periods as well to no avail

I followed this guide word for word.

not working at all. I installed visual studio code and still nothing.

" Open up the Command Palette and choose Templater: Insert Template . Chose the new Notice template you just created. A prompt should appear"

I opened up command pallete and all it did was inject the same template into the open template.

this is the most frustrating thing is the worst people end up making guides. idk why people like this even bother with making guides when there are clearly massive steps they left out.

The first thing you should try at this point is to stop and take 10 deep, slow breaths. (I’m not kidding. This is one of the most important things I’ve learned about dealing with computers.)

3 Likes

In the settings for the core Daily Notes plugin, I set the Date format to YYY-MM-DD HHMM, and I made a template for Daily Notes (a file anywhere, set in Daily Note settings) containing # {{date}} {{time}}. Then I clicked the Daily Note button in the sidebar, which made a file named 2022-06-16 1620, containing # 2022-06-16 16:20.

I assume this doesn’t fit your need, but you may find some comfort in seeing a note created with the date and time in its title and heading.

1 Like

I like to think I’m a patient person, this is after a week or so of on/off testing and I’m so lost I came here for some assistance.

I am fairly fluent in command prompt, some experience with linux/manjaro and scripting there, this is completely new territory and idk if it’s just bad luck that every guide i’ve come across assumes a litany of prerequisites (including years worth of jargon to learn) or it’s an introductory guide that is missing steps.

After doing digging (before posting this) was when I found out all of the guides left out that visual code was needed, so I made a successful .js file with the test script but it does absolutely nothing when clicked on from explorer or when i attempt to load from obsidian.

the person who posted above looks like a script i’ve been trying to get working all day but idk what i’m doing wrong.

There is a Shell Commands plugin, so if nothing else works, maybe you could use that to make a shell script do it. (I do a little shell scripting, but I haven’t used that plugin so can’t say anything about it from experience).

I don’t use Templater (yet?) and don’t know JS yet, so I’m afraid I can’t help much there.

do you think that is why this code isn’t working?

I was also trying to get the await js working which is what prompted me to look into this to begin with, as I wanted prompts to appear (which i successfully got working - would pop-up with a data field to enter info and places them correctly, however, it was doing the prompts from the bottom up, so I looked into this as well.

Originally I was ok with the name sync and the daily note title, but I’m really trying to organize my notes chronologically so I can go down and take care of things one by one as i created the notes.

I have really bad AHDH/ACDC and being able to see when i created the note from the title (for some reason) helps me to visualize what i was thinking about or going on at the time so i can try to contextualize my notes/thoughts/info.

Have you tried the Zettelkasten Prefixer core plugin? I think it does what you want.

This is a good, clear description of what you want.

I understand about the time/context thing. When I started organizing my projects in folders by year, I worried it might make things harder to find, but it’s worked well, I think because of what you describe.

I have a folder called 007.Templates and a template in the folder titled Daily Note Template.

This is how I have my template location set in the Templater settings.


I have the following setting in Periodic Notes for a Daily Note Template. You could also add the time into this setting.

With date only

With datetime


Add the snippet into the template anywhere. I have it after a Footnotes heading.


Templater should automatically rename the file. Here is a gif of my template.

daily-note-template

3 Likes

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