How Do I Split Date Parts and Paste Each Part?

How to use this macro and automatically split formats by MM dd and yyyy into respective clipboard

To explain further, I have in my sheet is a date with a format 4/19/2016. I want it to get the month and put in the Clipboard_Month as 04; then Clipboard_Day as 19; and Clipboard_Year as 2016.

So when I need to paste the date on different website with different date format I could custom type/paste depending on the site's date format.

Thanks

I think this pair of Macros should do the trick, or at least get you started.
Let us know if this works for you.

  1. Copy and Split Date into Parts [Example]
    • Select a date in the format month/day/year
      • Month and Day can be one or two digits
      • Year can be 2 or 4 digits
      • Can use any character for the delimiter (/.- etc)
    • Trigger the Macro
    • Macro splits date into parts, and stores them as Global Variables
      (no need for Named Clipboards)
      • Date_Month
      • Date_Day
      • Date_Year
      • Date_Full
        .
  2. Paste Date Part [Example]
    • Then when you're ready to paste any date part:
    • Click where you want to paste
    • Trigger the macro
    • Choose the date part to paste
    • Macro pastes that date part

Example Output

image

4

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MACRO:   Copy and Split Date into Parts [Example]

~~~ VER: 1.0    2019-12-12 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Copy and Split Date into Parts [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • **Copy and Split Date into Parts **

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. Select a date in the format month/day/year
    • Month and Day can be one or two digits
    • Year can be 2 or 4 digits
    • Can use any character for the delimiter (/.- etc)
  3. Trigger the Macro
  4. Macro splits date into parts, and stores them as Global Variables
    .
  5. Then when you're ready to paste any date part:
    • Click where you want to paste
    • Trigger the macro Paste Date Part [Example]
    • Choose the date part to paste
    • Macro pastes that date part

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro, and the Macro Group it is in.

REQUIRES:

  1. KM 9.0+ (may work in KM 8.2+ in some cases)
  2. macOS 10.11.6 (El Capitan)+

TAGS: @Date @Copy

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MACRO:   Paste Date Part [Example]

~~~ VER: 1.0    2019-12-12 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Paste Date Part [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Paste Date Part

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. Run this Companion Macro First: Copy and Split Date into Parts
  3. Then when you're ready to paste any date part:
    • Click where you want to paste
    • Trigger this macro
    • Choose the date part to paste
    • Macro pastes that date part

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro, and the Macro Group it is in.

REQUIRES:

  1. KM 9.0+ (may work in KM 8.2+ in some cases)
  2. macOS 10.11.6 (El Capitan)+

TAGS: @Date @Copy

2 Likes