Brandon Stephens headshot

Brandon Stephens

Howdy, I make websites and take photographs.

TextExpander Date Snippets

2014-08-27

Dates are important, but not enough to think about.

As a creative professional I have learned to keep good time sheets. This is how I make money and quote jobs. I also put a date on most everything I touch; filenames, notes, folders, etc. Having a date on a filename has been extremely valuable over the years. The only trick is it can be a pain to look up the dates when you are just trying to save a file or sort your downloads folder from the past day or week.

Enter TextExpander. I have been using TextExpander for almost a decade. TextExpander is amazing not only because it saves typing[1], it can do date math and when that is not enough, run shell scripts.

This makes it incredibly easy to date stamp the crap out of everything with very little mental effort. No more looking at a calendar to figure out what last Wednesday’s date was. I just let TextExpander do the work for me.

The only downside to becoming so reliant on these is that the Shell Scripts won’t run on the iOS version of TextExpander. But the Today, Tomorrow and Yesterday versions still do.

The latest versions are available on GitHub:
https://github.com/brandonstephens/bs-date-snippets

Snippet Overview

Example for the date Tuesday August 26, 2014.

abbreviation name example output
xdltu Last Tue 2014–08–19
xdlw Last Wed 2014–08–20
xdlth Last Thu 2014–08–21
xdlf Last Fri 2014–08–22
xdlsa Last Sat 2014–08–23
xdlsu Last Sun 2014–08–24
xdlm Last Mon 2014–08–25
xds Today 2014–08–26
xdnw Next Wed 2014–08–27
xdnth Next Thu 2014–08–28
xdnf Next Fri 2014–08–29
xdnsa Next Sat 2014–08–30
xdnsu Next Sun 2014–08–31
xdnm Next Mon 2014–09–01
xdnt Next Tue 2014–09–02
d++ tomorrow 2014–08–27
d-- yesterday 2014–08–25
xdts date and time 2014–08–26 10.09.10

Tomorrow

Content
Plain Text
%@+1D%Y-%m-%d

Yesterday

Content
Plain Text
%@-1D%Y-%m-%d

Today

Content
Plain Text
%Y-%m-%d

Last Day

Content
Shell Script

Just change line 2 of the code below to contain the day you want. Valid names include: Mon, Tue, Wed, Thu, Fri, Sat and Sun.

#!/bin/bash
day='Fri'
today=`date "+%a"`

if [ "$today" == "$day" ]
then
  VAR=$(date -v-7d "+%Y-%m-%d")
else
  VAR=$(date -v-"$day" "+%Y-%m-%d")
fi

echo -n $VAR

Next Day

Content
Shell Script

Just change line 2 of the code below to contain the day you want. Valid names include: Mon, Tue, Wed, Thu, Fri, Sat and Sun.

#!/bin/bash
day='Fri'
today=`date "+%a"`

if [ "$today" == "$day" ]
then
  VAR=$(date -v+7d "+%Y-%m-%d")
else
  VAR=$(date -v+"$day" "+%Y-%m-%d")
fi

echo -n $VAR

  1. TextExpander has saved me typing over 500,000 characters so far according to its statistics.  ↩