-
Hi, I'm creating a week planning note and want to create the dates for each of the days based on the date in the filename. I'm extracting the date which is in the title of the file. The regex format is [0-9]{4}).([0-9]{2}).([0-9]{2}
I thought I could:
This didn't work. Does anyone know how to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
We can modify one of the examples found in the docs to do what you want. For example, if your filename is formatted as <% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>
<% tp.date.now("YYYY-MM-DD", 2, tp.file.title, "YYYY-MM-DD") %>
<% tp.date.now("YYYY-MM-DD", 3, tp.file.title, "YYYY-MM-DD") %>
<% tp.date.now("YYYY-MM-DD", 4, tp.file.title, "YYYY-MM-DD") %>
etc... If your filename has other characters in there, you can still avoid regex by escaping characters in the format. For example, if your filename was <% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "[Weekly note] YYYY-MM-DD") %> Relevant docs explaining the four arguments we're passing to |
Beta Was this translation helpful? Give feedback.
Just realized you're using
YYYY.MM.DD
instead ofYYYY-MM-DD
, but should be able to swap out the reference format.