|||

There’s only One Right Way to Type the Date

PTPL 137 · And, no, yyyy and YYYY are not the same thing in an Obsidian template


This article has been edited for clarity

When the last two digits of the year change, as every 12 months they inevitably do, muscle memory tends to work against us. As Johnny Decimal says, don’t type the date by hand! Johnny recommends using Raycast to create a snippet that automatically creates today’s date in the correct format.

Yes, I said correct format because there’s only one right way to type the date but many wrong ways that cause the space-time continuum to shake on its timey-wimey foundations! I’m not talking about the dates you hand write in longhand at the top of a physical page; knock yourself out with those. This is about dates written entirely in numbers.

I’ve known for years that year-month-day is the only format that sorts chronologically in the digital world, but what I didn’t know when this post was published is that of the two ways to write the code that becomes year-month-day dates (yyyy-mm-dd and YYYY-mm-dd), it matters which one you choose.

Both can be correct, in the right context.

Please bear in mind that I’m not a coder. I learn what I need to in order to do what I want to do, and only use the whole yyyy thing in apps like Obsidian, Keyboard Maestro, and Drafts. The information presented here relates to those apps only; not the broader coding world (not that I’d know it if they did!).

This post from David Smith showed me that yyyy is the one most people are looking for. When I was creating Obsidian templates for my weekly notes, however, YYYY was the correct choice. I finally understand why they aren’t and should not be interchangeable. yyyy gives you an independent 4-digit year, while YYYY gives the year relative to the week of the year. ^1

Forgive me for not explaining it better than that; I have much to learn. If you’re creating templates in Obsidian, just remember that you need to use yyyy if you don’t want the last few days of the year to show the incorrect year.

Your assignment, should you choose to accept it, is to set yourself up with a keyboard shortcut to insert the correctly formatted current date wherever it’s needed. Text Expander and Keyboard Maestro are two capable paid options, or you can follow Johnny’s instructions to use the free utility, Raycast. There are others. ^2

Obsidian has the Natural Language Dates plugin that does the job nicely, but I recommend a system-wide solution that doesn’t just work in one app alone.


[^1] There’s also gggg and GGGG for week years. I have yet to learn the difference between the Gs and the Ys. See https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/

[²] I don’t know all the ways to automatically add the date when typing, but there are a lot of them. Text Expander, for example. In Keyboard Maestro I use (%ICUDateTime%yyyy-MM-dd%), in Drafts [[date|%Y-%m-%d]].Note that the code Drafts uses for dates is a little different. Learn more here.


💬 I love to hear from readers! Comment via email · Mastodon · Bluesky

If you get value from my work I invite you to share this post with someone you think will like it, or to make a contribution to my support jar. Every gift helps to keep me an independent creator and is greatly appreciated. You may also like to check out the free resources on my productivity themed Gumroad store.

Follow my RSS feed, or sign up to receive posts in your inbox  

 

Up next Why Do New Year’s Resolutions? Every Day is Already a Fresh Start Daily Notes Don’t Need to Live in Separate Files
Latest posts Done-for-You Markdown Dates for Organising an OBTF Calendar Headers for 2025 OBTF - Sunday Start Calendar Headers for 2025 OBTF - Monday Start Using todo.txt in Obsidian (Or Wherever You Like), Part 2 Using todo.txt in Obsidian (Or Wherever You Like), Part 1 2 Proprietary Apps Designed to Set Your Data Free Daily Notes Don’t Need to Live in Separate Files There’s only One Right Way to Type the Date Why Do New Year’s Resolutions? Every Day is Already a Fresh Start This is Why To Do Apps Fail and What I’m Using Instead Paper, or Paperless? Yes Please Kindness, Hope, and a Christmas Carol from Me to You Eventually Consistent: a PKM Allegory on Taking Imperfect Action Now PTPL 132 · Happy To Do Lists · Better Queries in Obsidian · Trip Template · Avoiding App Lock-in Classifying Notes in an OBTF, Inspired By the Dash-Plus System 2025 Markdown Calendars If You’re Keeping Tasks in Your Calendar, I Hope You Know What You’re Doing No and Low-Clutter Gifts for Apple, PKM, and Analog Enthusiasts PTPL 129 · Live Out of Your Notes the Way Tom Lives Out of His Car Inktober 2024 PTPL 128 · Keep Your Content Separate From the Container in Which It Lives PTPL 127 · On Backing Up Paper, and Static Websites for Tiny Archives Efficient App Agnostic Tasks in a Single Plain Text File (Obsidian Optional) PTPL 126 · What the Dash-Plus System Looks Like in My OBTF and Analog Notes Word Puzzles (that aren’t Wordle) PTPL 125 · Choosing Between Digital and Analog, and a Plain Text Accounting Update How to Keep Your Wheels Turning Smoothly Despite the Automation Paradox PTPL 124 · Saving Safari tabs as Markdown links, and Mono Fonts in Obsidian Looking Through Windows (From the Outside In) PTPL 123 · ‘Analog Office’ Blog and Tomoe River Planner Recommendations Mastodon and the Fediverse — Social Media’s Brighter Future
... ... ... ...