TextExpander
 

Help: Date, Time, and Math Macros


Date / Time Snippets

Create a date or time snippet using the Insert menu

  1. Create a new snippet by clicking New Snippet new snippet button in the TextExpander menubar.
  2. At the top of the snippet editor, click on the Date or Time buttons.
  3. Select a series of Year, Month, Day or Hour, Minute, Second options. Include all the punctuation and spacing you would like.

    For example, if you want a date to appear in this format “January 3, 2020”, insert the following:

    • Choose Date > Month: January. Add a space.
    • Choose Date > Day: 1. Add a comma and a space.
    • Choose Date > Year: 2001
  4. Choose an abbreviation in the Abbreviation box. We like abbreviations like “ddate” and “ttime” since they are simple to type and remember.

How date / time snippets work

TextExpander allows you to create snippets which expand the current time and date. These types of snippets use special codes (macros) which appear as small visual blocks, and are easily customizable.

For example, TextExpander comes with a sample snippet, “ddate”, for the current date. Type the abbreviation, “ddate”, and the current date will appear like this : January 3, 2020  (assuming this is the current date).

Each portion of the date is represented by a visual block which notes which piece of date, or time, and which format, it represents.

Whichever arrangement of date you want, simply drop in the macros, or pieces of the date, in that order, from “January 3, 2020” to “20-01-03.” Options include:

  • Time

    24-hour clock, 1-2 digits (0-23) or 2 digits.

    12-hour clock, 1-2 digits (0-12) or 2 digits

    Minute, 1-2 digits (0-59) or 2 digits

    Second, 1-2 digits (0-59) or 2 digits

    Time, AM/PM

  • Date

    Year, 2 digits (11) or 4 digits (2011)

    Month, short name (Jan) or long name (January)

    Month, 1-2 digits (1-12) or 2 digits (01-12)

    Day, short name (Mon) or long name (Monday)

    Day, 1 digit (1-31) or 2 digits (01-31)

Legacy Date Formats and Unicode

If you are familiar with the prior style of entering TextExpander date formats, with the <Percentage+Letter> notation, and you would like to still use that format to enter dates, switch the Content of the snippet from "Plain Text" or "Formatted Text, Picture" to one of the script formats. The macro syntax will be revealed, and you may put in whatever you wish. This will strip all formating if you are switching from a "Formatted Text, Picture" snippet. Once you are done entering your dates, switch back to your initial snippet Content style.

This is how you can enter Unicode dates, which support other speciality date styles (where <Unicode Date Format> is defined here: http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns)

Date / Time Math

Make a snippet to show a past or future date or time using math macros. This involves placing a math macro directly in front of a date or time macro. Date/time macros are explained above. For example, say you are in the Accounts Receivable department and routinely need to remind people to pay you in 15 days time. You can create a date snippet that will always expand to a date 15 days in the future.

Create a snippet using date / time math:

  1. Create a new snippet by clicking New Snippet new snippet button in the TextExpander toolbar.
  2. At the top of the snippet editor, from the editing bar, click on Math and click Add Day(s).
  3. A dialog will pop up and allow you to pick how many days you want to add to the date. In this instance, 15. Then continue adding the rest of your date.
    For example, if you want a date to appear in this format “Tuesday, 3 January 2020”, insert the following:

    • Choose Math > Add Days.
    • Choose Date > Day: Monday. Add a comma and a space.
    • Choose Date > Day: 1. Add a space.
    • Choose Date > Month: January. Add a space.
    • Choose Date > Year: 2001
  4. Give your snippet an abbreviation, such as “d15” or “payupnow”.

date math submenu

Subtract days

To subtract the value instead of add, simply choose a “Subtract” option from the Math menu.

Use multiple dates in a single snippet

Math macros apply to all subsequent date and time macros which follow them in the whole snippet, including embedded/nested snippets, and are not cumulative.

Assuming you have two dates in a single snippet, and you want the first date to be in the future, and the second date to be today, the second date will need to zero out the effects of the first math macro.

For example, if the first date in your snippet is 15 days in the future, directly after that date place a math macro to subtract 15 days. This way all the dates afterwards will be unaffected.

(For more macros, see Advanced Snippet Functions: Macros).

 

Smile logo

© 2006-2019 SmileOnMyMac, LLC, dba Smile. All rights reserved.
TextExpander is a registered trademark, Smile and the Smile logo are trademarks of SmileOnMyMac, LLC, dba Smile.