Can I Create Macros for Inserting Date and Time?

date_time

#1

Hello, newbie question here, thanks in advance — how can I create macros, triggered by keystroke chord combinations, that will print today's date this way:

Friday, January 11, 2019 — option-command-D
•1/11/19 — shift-control-D
1-11-19 — option-command-D

And just to let you know I at least tried something - - on the KM editor in the actions section in the search box, I typed the word "date" but it returned no results, regardless of which category I have highlighted. And the KM wiki gets into a complicated discussion of "tokens" but doesn't seem to go straight to the simplest answer.

Thanks again, cheers! -Les


#2

Hey Les,

Welcome to the forum!  :smile:

Always try searching with the search field the Keyboard Maestro Editor Help Menu – you never know what you'll find -- actions, text-tokens, functions, and menu-items...

If you haven't read this it's worth a couple of minutes of your time.

Tip: How Do I Get The Best Answer in the Shortest Time?

In answer to your question, here's a sample macro:

Date and Time -- ICU Date Construct.kmmacros (4.1 KB)

Change the keyboard shortcut to your desired chord.


The other date patterns you wanted are:

•1/11/19	⇢		•%ICUDateTime%M/dd/yy%


1-11-19		⇢		%ICUDateTime%M-dd-yy%

Keep in mind that it's generally worth searching the forum a time or two for what you need:

https://forum.keyboardmaestro.com/search?q=insert%20date

And it's worth looking on the wiki:

https://wiki.keyboardmaestro.com/Dates_and_Times


-Chris