Introduction
Note: This article is written for Mac users.
In a previous article, “How to Customize Date Format Using Terminal on macOS,” I showed how to change the date format using Terminal. A macOS update had changed the date format, and I could no longer use “DD/MMM/YY,” the format I use every day. So the article was about rewriting a system setting to bring it back.
I might write about this in more detail in another article, but I recently got a new Mac. While I was setting it up, I remembered that I had made this setting change before.
I could have just done it again with Terminal like last time, but this time I tried doing the same thing with the Shortcuts app. Actually, this way felt easier, so I’ll write a little about it.
Inserting Dates with Shortcuts
The shortcut I made is a simple one with just these five actions:
- Receive: Set to receive input from Quick Actions (If there’s no input: Continue)
- Current Date: Gets the current date and time
- Format Date: Formats it however you like (set Date Format to Custom and enter dd/MMM/yy)
- Copy to Clipboard: Copies the formatted date to the clipboard
- Run AppleScript: Pastes it
Here’s the AppleScript at the end:
on run {input, parameters}
delay 0.1
tell application "System Events" to keystroke "v" using command down
return input
end run
All it does is paste the copied date with ⌘V. The delay 0.1 is just a tiny wait so the paste doesn’t run before the copy has finished. Also, if you only need the date copied and don’t want it pasted, just remove the AppleScript part, and the shortcut will stop once the date is on the clipboard.
After that, turn on Use as Quick Action in the shortcut’s settings and assign a keyboard shortcut. Then you can insert the date in your preferred format with a single keyboard shortcut in any app. The first time, you may be asked to allow it to control System Events. If a popup appears, you can simply enable it from Settings.
By the way, in my case, I want to use both a date-only version and one that includes the time, so I also made a shortcut called Insert Timestamp with the same structure. The only difference is the Format Date format: this one includes the time, like dd/MMM/yy HH:mm:ss.
Differences from the Terminal Version
The Terminal method I introduced in the previous article rewrote the system-wide date format itself. As I mentioned in that article, there were a few things to keep in mind, such as the effect on apps and the possibility of the setting being reset by an update.
On the other hand, this Shortcuts version doesn’t touch the system settings at all. It just creates a date string and pastes it. If you don’t need it anymore, you can just delete the shortcut, and if you want to change the format, you only need to edit Format Date. So my impression is that it’s easier to manage and less likely to cause trouble.
Conclusion
If you don’t want to go as far as rewriting system settings like in the previous article, but you still want the date format your way, I think this approach is a better fit. It was a bit of a niche topic, but since it’s easy to customize the format and other details to your liking, feel free to give it a try if you’re interested.
Thank you for reading!
Top comments (0)