|||

PTPL 137 · There’s only One Right Way to Type the Date

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 PTPL 136 · Why Do New Year’s Resolutions? Every Day is Already a Fresh Start PTPL 138 · Daily Notes Don’t Need to Live in Separate Files
Latest posts Append, Not Prepend, if You Want to Craft a Dashboard at the Top of Your Daily Notes One Big Text File - the What and the Why Yes, Plain Text Friends, Some Open Formats Are Opener Than Others PTPL 151 · Why the Openest of Open Formats Isn’t the One for Me PTPL 150 · Simplicity Is Great but There’s a Key Lesson in This Genius Complexity PTPL 149 · 3 Tiny PKM-Themed Wisdom Snippets to Beat Digital and Analog Overwhelm PTPL 148 · How to Keep Your Googly Eyes on Your Mouse Pointer (and Off Google) There is Peace in Boundaries PTPL 147 · This Is Why You Might Want to Keep Multiple Daily Notes as Well as an OBTF PTPL 146 · Please Leave Me Alone, I’m Deliberately Distracted Changing From Hledger to Beancount PTPL 145 · Folders or Tags or Index Pages? They’re Tools, Not a Debate PTPL 144 · Browser Switching Time! Bye-Bye Arc, Hello Vivaldi PTPL 143 · You Don’t Need Any of the 6 Drafts App Alternatives I’ve Been Playing With Lately PTPL 142 · Done-for-You Markdown Dates for Organising an OBTF Calendar Headers for 2025 OBTF - Sunday Start Calendar Headers for 2025 OBTF - Monday Start PTPL 141 · Using todo.txt in Obsidian (Or Wherever You Like), Part 2 PTPL 140 · Using todo.txt in Obsidian (Or Wherever You Like), Part 1 PTPL 139 · 2 Proprietary Apps Designed to Set Your Data Free PTPL 138 · Daily Notes Don’t Need to Live in Separate Files PTPL 137 · There’s only One Right Way to Type the Date PTPL 136 · Why Do New Year’s Resolutions? Every Day is Already a Fresh Start PTPL 135 · This is Why To Do Apps Fail and What I’m Using Instead PTPL 134 · Paper, or Paperless? Yes Please Kindness, Hope, and a Christmas Carol from Me to You PTPL 133 · 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
... ... ... ...