Translate an informal or relative date phrase to an ICU or unix epoch date

Translate informal date phrase to ICU date.zip (6.7 KB)

Custom Keyboard Maestro Plug-in

NAME

  • Translate informal or relative datetime phrase to ICU datetime

VERSION

  • 0.1

SYNOPSIS

Given an informal or relative date-time phrase like:

        now +7d
        july 20
        tomorrow at 2pm

and an ICU date time format like:

        EEE, MMM d, yyyy h:mm

EITHER returns a formatted date like:

        Sat, Aug 29, 2015 11:28
        Wed, Jul 20, 2016 12:00
        Mon, Aug 24, 2015 2:00

OR if the formatting string is left blank, returns an integer string which represents the number of seconds elapsed since the start of the Unix Epoch at 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.

NOTE

  • Unix Epoch seconds are also used by the Keyboard Maestro date Calculation functions, so output captured from this action in a variable can be used, if needed, in KM calculations.

REQUIREMENTS

  • Yosemite
    • The underlying script is written in Javascript for Applications

INSTALLATION

  • Drag the .zip file onto the Keyboard Maestro icon in the OS X toolbar.
  • (if updating a previous version of the action, first manually remove the previous copy from the custom actions folder)
    • ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions

CONTACT

(Based on the SmallTime.js code at: https://github.com/RobTrew/txtquery-tools/tree/master/smalltime.ftplugin )

4 Likes