[Solved] How to convert text 'Aug 5, 2023" to "5 Aug, 2023'?

I may have any date in the format: Aug 5, 2023.
This date would be saved to a variable.
I need to conver this format into: 5 Aug, 2023, saving it to the same variable.

Is there a way to do that? (if it involves regular expression, I don't know how to use regular expression)

Sure.

Here is one way. There are many others.

Change Format.kmmacros (3.1 KB)

Macro Image

KC

3 Likes

Thank you :blush:

1 Like

As @kcwhat mentioned, there are many ways to skin the cat. If you'd like to add some simple error checking, you could use this approach.

Download: Change Format With Simple Error Checking.kmmacros (3.6 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.4.1 (22F770820d)
  • Keyboard Maestro v10.2

If you might have other input date formats, check out this thread started by @JMichaelTX (RIP): Convert Date String from One Format to Another [Example]

1 Like