TextExpander: Date and Time Math

Let’s say it’s your job to remind people to do something. Maybe you are the accounts receivable person, and you regularly need to remind people to pay you in 15 days. If you use TextExpander, your days of looking at the calendar and calculating that date are over!

We added date and time math capability to TextExpander 2.5. Now you can create a snippet that automatically inserts a date that is 15 days from today. Here’s how:

1) Create a new snippet by clicking on the plus (+) sign under your list of snippets on the left in the TextExpander Preference pane.

2) Click on the plus (+) sign under the snippet content pane on the right. Choose Date/Time Math > Add Day(s).

3) TextExpander inserts %@+1D into your snippet content pane. Change “1D” to “15D”.

4) Insert the date format you wish to appear, again using the plus (+) sign menu on the right. For example, if you want the date to appear in formatted “October 29, 2008″, insert the following:
- Choose Date > Month > January. Add a space.
- Choose Date > Day > 1. Add a comma and space.
- Choose Date > Year > 2001

5) When you are done, the snippet content should be:
%@+15D%B %e, %Y

6) Give your snippet an abbreviation, such as “d15″ or “payupnow”.

TextExpander 2.5 is a free upgrade to registered users of TextExpander 1.x and earlier. You can download it here. Besides the date/time math, we’ve also added some new built-in snippet groups: Internet Productivity (which includes the AppleScripts we’ve posted here for URL shortening) and Symbols (for those who need to use symbols like copyright, trademark, euro, yen, infinity, etc.).

20 Responses to “TextExpander: Date and Time Math”

  1. Hi folks,

    According to Greg, I was the first to request the date math functionality (back in July 2006). I’m very happy to see the functionality make it in to TextExpander. Better late than never :) Thanks a bunch folks!

    Mike

  2. Laszlo says:

    Your instructions were confusing. Took me a while to uderstand the difference between the two “+” locations. You should have a screen shot of each to clarify.

    Also you should mention that in creating dates, you can insert separators like “/” which some programs require.

  3. Tj says:

    I’m glad to see TextExpander continuing to grow and expand (HA! Unintentional) its capabilities. It continues to be an app I don’t want to use a Mac without.

    Thanks!

  4. Ryan Burnett says:

    Nice to see these great (and free) features continuing. Keep ‘em coming!

  5. gz says:

    Yes its a nice tool, but for german users, it could have a TideBits in (of corse) german too :-)

    You could make a lot of Money

  6. Zettt says:

    We are working on it currently. Please be a little more patient ;)

  7. Jean says:

    @Zettt: ich kann gar nicht dafür warten. (Trans. I can hardly wait–for the German autocorrect snippets!)

  8. Zettt says:

    @Jean I love these Babelfish-like translations ;) I think i said that already. Just checking out the auto-corrections. I think the first one will be ready by next month, which is in a few days. ;)

    As you said. People can subscribe and i can improve them in the background. (Which is amazing!)

  9. Jean says:

    @Zettt Ich nehme es an, daß Du mein Deutsch nicht besonders gut findest.Schade. Ich habe ein Jahr in Freiburg studiert, aber man kann ein bißle vergessen. ;-)

  10. Duncan says:

    I adore Text Expander, but now I am totally IN LOVE. Thanks for Version 2.5 crew. TE is my all time fave app on my mac.
    Characters Saved: 1,425,757
    Keep in Happy Places,
    Duncan

  11. Zettt says:

    Oh Sorry… I didn’t want to say anything to hurt you.

  12. [...] to insert the time, the clipboard or even another snippet. New in version 2.5, you can insert a conditional date or time. So if you keep having to tell people to give back your cash 1 week later, instead of hunting for [...]

  13. Jeff says:

    I love Text Expander. I’m wondering though if with date and time math I can insert a date that’s say, 5 BUSINESS days, after the current date. Possible? Is there a way to build this myself via Applescript if not? Any suggestions would be great!

  14. Ron Belisle says:

    Love TextExpander. Thanks for making my life easier.

    Question. In my spreadsheet program (Numbers) I create invoices in Japanese for my clients in Japan. On the first page of the invoice, I insert the date using TextExander using %Yå¹´ %m月 %dæ—¥. It works and inserts the date like this — 2009å¹´ 04月 01æ—¥ — which is correct. Then on the 2nd and third pages, I would like the date to be one day less, for example, 2009å¹´ 03月 31æ—¥. Is this possible to automate the date insertions on the second and third pages of my invoice using TextExpander?

  15. Jean says:

    Ron: Interesting question. Can you send it to textexpander@smileonmymac.com?Our support team can help you out with that.

  16. Jim says:

    I wanted to do the same thing as Jeff–I send out a lot of form emails requesting a response by a date three business days in the future. I hunted around a bit and didn’t find anything, so here’s what I cobbled together. This returns a date three business days in the future in the form “Monday, January 1″:

    set currentDate to current date
    set today to weekday of currentDate
    if today is Monday then set dueDate to currentDate + (3 * days)
    if today is Tuesday then set dueDate to currentDate + (3 * days)
    if today is Wednesday then set dueDate to currentDate + (5 * days)
    if today is Thursday then set dueDate to currentDate + (5 * days)
    if today is Friday then set dueDate to currentDate + (5 * days)
    if today is Saturday then set dueDate to currentDate + (4 * days)
    if today is Sunday then set dueDate to currentDate + (3 * days)
    return ((weekday of dueDate) & “, ” & (month of dueDate) & ” ” & (day of dueDate)) as text

    There are probably simpler or more elegant ways, but this seems to do the trick–if I send something out on Monday it gives me Thursday, if I send something out on Thursday it gives me next Tuesday, etc. If you want five business days in the future, or some other number, you can modify the numbers in each line accordingly to get the right day in the future for each weekday. If you want the date in a different format you can do that too by modifying the last line. (I think there are ways to return months as integers and such if you want something like 1/1/2010.) Save this as an AppleScript snippet in TextExpander and then insert it within another snippet.

  17. mooncaine says:

    Is there a way to make a dialog pop up that asks me to input a date, and a number of days to subtract? That way, I could trigger the snippet, input a date, input a number of days, and get the date from, for example, exactly 28 days before the date I typed in as input.

  18. Jean says:

    mooncaine: That’s not possible in the current version of TextExpander, but we’ll had that to our feature requests list. Thanks for the feedback.

  19. Vijay says:

    I’m wondering how to specify two timezones simultaneously. For example:
    CDT: %B %e, %Y, %1I:%M %p
    IST: ??? (Is there a shortcut for this?)

    In a desperate attempt to manually add time, I tried date/time math to show: %@+10h%@+30m%B %e, %Y, %1I:%M %p. This doesn’t seem to work. Looks like I can either add/subtract hours or minutes individually, but I can’t seem to do both. In other words, I am only able to add 10 hours or 30 minutes, but couldn’t figure how to add 10 hrs and 30 minutes. Am I missing something?

  20. Greg says:

    I’m afraid that yes, only one type of time math is permitted. In your case, you would use the fact that all time math can be converted into smaller units, so adding 630 minutes is the same as adding 10 hours and 30 minutes: %@+630m%B %e, %Y, %1I:%M %p will do what you need.

Leave a Reply