10

I often write short text documents on my iPhone, and want to insert a date stamp in the format YYYY-MM-DD. Is there a utility or other means by which I can quickly insert a date stamp instead of typing it manually each time?

3 Answers 3

4

Sadly, the Shortcuts app is one item short of doing this pretty much natively.

It has a text function that pastes in the value of the current date, but there isn’t ISO formatting option.

I tried a Pythonista script that works very well to get the values you need, just am missing some glue to turn it into a shortcut.

import datetime
iso = datetime.date.today().isoformat()
print(iso)

enter image description here

Siri can even trigger this shortcut (or share sheet) for you, once I figure out how to get the two connected.

enter image description here

3
  • I wonder if I can use the clipboard module to `clipboard.set(iso) to get the value from Python to paste into whatever app / receiver script I run in shortcuts app.
    – bmike
    Commented Mar 10, 2019 at 21:26
  • 3
    The „Format Date“ Action has an option to use a user-supplied date format, you can use YYYY-MM-DD there.
    – nohillside
    Commented Mar 11, 2019 at 6:59
  • @nohillside I missed that totally. Time to make new screen shots and perhaps edit this...
    – bmike
    Commented Mar 11, 2019 at 22:52
3

In the shortcut you build, instead of choosing short, medium, etc, scroll down to ‘custom’ and you can use formatting just as you have it: yyyy-mm-dd add an

2

Another way to tackle this might be to use the stock Apple Keyboard Text Replacement feature in Settings. I’m doing this now with a text replacement for “jgday” that spits out a formatted date (e.g., 2021-06-18). The downside is that I have to manually edit the date in Settings every morning.

I’m trying to program that step with the Automation feature in Apple Shortcuts so that the text replacement gets automagically modified just after midnight - I haven’t figured out how use Shortcuts to modify an entry in Settings/General/Keyboard/Text Replacement yet, but still exploring.

One other minor issue is that Text Replacement adds a space when executed that I frequently need to erase for naming files, but I’ll suffer with that limitation for the time being.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .