Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

System-wide Insert Date in number only format (YYYY/MM/DD) or similar

I found this by: Luis Sequeira1 User level: Level 8 (43,284 points)


script to run in automator a system service:

on run {input, parameters}

set thedate to (current date) as string

tell application "System Events"

keystroke thedate

end tell

end run


It works well to get the long date and time, you get a result like: lunes, 31 de mayo de 2021, 19:47:37 (Spanish in my case)


but I am looking to get a date stamp like the one you get in Filemaker when you press COMMAND + "-" In my case with my system date format I get 2021/05/31, may variate depending on system setup.


Any ideas on how create an apple script or Automator system service to get the short date format to paste in any document? Also I would add a ": " to the end of the date so the final pasted date is: "2021/05/31: "

MacBook Pro 13″, macOS 11.4

Posted on May 31, 2021 11:04 AM

Reply
Question marked as Best reply

Posted on May 31, 2021 1:04 PM

You could just create an Automator Quick Action that receives no input from any application. Instead of a Run AppleScript action, use a Run Shell Script using Zsh or Bash:


date -j +"%Y/%m/%d" # outputs YYYY/MM/DD formatting


These formatting codes are found in the strftime(3) man page.


Save it with the name: DateStamp.


Looks like this (you will need to update the date formatting string):



In System Preferences > Keyboard panel > Shortcuts > Services panel, you locate this service and assign a non-conflicting keyboard shortcut to it. And then, anywhere you want that date stamp text inserted, you press that keyboard shortcut.

Similar questions

4 replies
Question marked as Best reply

May 31, 2021 1:04 PM in response to SonyMiner

You could just create an Automator Quick Action that receives no input from any application. Instead of a Run AppleScript action, use a Run Shell Script using Zsh or Bash:


date -j +"%Y/%m/%d" # outputs YYYY/MM/DD formatting


These formatting codes are found in the strftime(3) man page.


Save it with the name: DateStamp.


Looks like this (you will need to update the date formatting string):



In System Preferences > Keyboard panel > Shortcuts > Services panel, you locate this service and assign a non-conflicting keyboard shortcut to it. And then, anywhere you want that date stamp text inserted, you press that keyboard shortcut.

System-wide Insert Date in number only format (YYYY/MM/DD) or similar

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.