- Launch Automator, select Quick Action, and then click Choose.
- In the Quick Action heading, you want Workflow receives [ no input ] in [ any application ]. Change nothing else in that panel.
- In the Utilities Library, select Run Shell Script and drag/drop it into the large workflow window.
- Shell: /bin/zsh or /bin/bash (whichever is your default SHELL setting)
- Pass input: [ to stdin ]. Actually this does not matter as the workflow is not receiving any input.
- Copy and paste the following comments and commands shown in CODE (below) into the Run Shell Script action.
- In the Quick Action header, select Output replaces selected text. You do not have to select any text to have the date stamp written to the text area that you intend.
- Save it (it will be automatically put in the ~/Library/Services directory and you can just give it a name (e.g. DateStamp).
CODE
# Date format codes https://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html
# Mar 29 2022
/bin/date -j +"%b %d %Y"
Now, you want to give it a keyboard shortcut. In System Preferences > Keyboard > Shortcuts > Services panel, scroll down until you encounter the Service name you have given it and this will be in the Text category of Services.
You will see the Service entry (e.g. DateStamp) and a right-column with the text none. Click none, and a [ Add Short ] button will appear in its place. Click it once, and enter the keystrokes for the shortcut. I use control-d (which will appear as ^D. Once you have done that, quit System Preferences. From a given application, you may need to manually select Application Name menu > Services > DateStamp once to apply the date string before the keyboard shortcut will work.
The Automator Quick Action will look like this when you save it.