The Smile Blog, With News, Tips, Photos and Other Stuff That Makes Us Smile

TextExpander: Date and Time Math

Posted 10/28/2008 by Greg

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 and later. 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 window.

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.).


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 smile Thanks a bunch folks!


Posted by Michael Larocque  on  10/29/2008  at  05:19 AM

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.

Posted by Laszlo  on  10/29/2008  at  05:51 AM

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.


Posted by Tj  on  10/29/2008  at  07:52 AM

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

Posted by Ryan Burnett  on  10/29/2008  at  09:41 AM

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

You could make a lot of Money

Posted by gz  on  10/29/2008  at  10:30 AM

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

Posted by Zettt  on  10/29/2008  at  02:03 PM

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

Posted by Jean  on  10/29/2008  at  02:31 PM

@Jean I love these Babelfish-like translations wink 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. wink

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

Posted by Zettt  on  10/30/2008  at  02:57 PM

@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. wink

Posted by Jean  on  10/30/2008  at  03:20 PM

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,

Posted by Duncan  on  10/30/2008  at  11:00 PM

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

Posted by Zettt  on  10/31/2008  at  02:10 PM

[...] 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 [...]

Posted by Save keystokes with TextExpander | Smoking Apples  on  11/05/2008  at  10:10 AM

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!

Posted by Jeff  on  12/17/2008  at  12:06 AM

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?

Posted by Ron Belisle  on  04/01/2009  at  05:52 AM

Ron: Interesting question. Can you send it to support team can help you out with that.

Posted by Jean  on  04/01/2009  at  07:23 PM

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.

Posted by Jim  on  08/31/2009  at  02:44 AM

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.

Posted by mooncaine  on  01/04/2012  at  05:21 PM

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.

Posted by Jean  on  01/04/2012  at  06:25 PM

Add Your Own Comment:

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below: