Curious Chase

Curiously Chase

Using Current Date and Time In VS Code Snippets

Share on Twitter

Previously when generating new blog articles (inVS Code, now I generate articles in Obsidian), adding dates to Markdown frontmatter was a manual step that required me to:

As of VS Code release 1.20, Snippets have access to the current date and time with one of the following variables:

Now if I want a frontmatter "date" for Markdown for the current year, month and day (YYYY-MM-DD), I can add the following to my snippet:


Using the published date of this post, the expanded snippet produces:

date: "2018-07-24"

Markdown snippet with current date and time automatically inserted

Share on Twitter