| # Help: Date, Time, and Math Macros ### Date / Time Snippets Create a date or time snippet using the Insert menu Create a new snippet by clicking New Snippet in the TextExpander menubar. Click the Insert menu located just above the Abbreviation box. You will see both Date and Time options. Select a series of Year, Month, Day or Hour, Minute, Second options. Include any punctuation you would like. For example, if you want a date to appear in this format “January 3, 2012”, insert the following: Choose Date > Month > January. Add a space. Choose Date > Day > 1. Add a comma and a space. Choose Date > Year > 2001 Choose an abbreviation in the Abbreviation box. We like abbreviations like “ddate” and “ttime”. 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) to do so, 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, 2012 (assuming this is the current date). Each portion of the date is represented by a percentage sign and letter combination (macro), each of which stands for a particular format for showing Month, Day, and Year. In order to change a given date format, change the macros involved and their order. For example: For this date format “January 3, 2012”, where Month is a word, Day is a number, and Year is a number, use these characters “%B %e, %Y”. For this date format “12-01-03”, where Year is a number, Month is a number, and Day is a number, use these characters “%y-%m-%d”. The following is a list of macros that can be used in TextExpander in date and time snippets: Time %1H = Hour, 24-hour clock, 1-2 digits (0-23) %H = Hour, 24-hour clock, 2 digits (00-23) %I = Hour, 12-hour clock, 2 digits (00-12)* %1I = Hour, 12-hour clock, 1-2 digits (0-12)* %M = Minute, 2 digits (00-59) %1M = Minute, 1-2 digits (0-59) %S = Second, 2 digits (00-59) %1S = Second, 1-2 digits (0-59) %p = Time, AM/PM %z = GMT offset %Z = timezone *Note the codes for 12-hour clock use a capital letter i Date %Y = Year, 4 digits (2011) %y = Year, 2 digits (11) %B = Month, long name (January) %b = Month, short name (Jan) %m = Month, 2 digits (01-12) %1m = Month, 1-2 digits (1-12) %A = Day, long name (Monday) %a = Day, short name (Mon) %d = Day, 2 digits (01-31) %e = Day, 1 digit (1-31) %j = numerical day of year %date:<Unicode Date Format>% (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: Create a new snippet by clicking on New Snippet in the TextExpander menubar. Click on the Insert menu located just above the Abbreviation box. Navigate to Date/Time Math > Add Day(s). TextExpander inserts the special code %@+1D, aka math macro, into your snippet content. Change “1D” to “15D”. Insert the date format you wish to appear using the Insert menu, located just above the Abbreviation box. For example, if you want the date to appear in this format “January 3, 2012”, insert the following: Choose Date > Month > January. Add a space. Choose Date > Day > 1. Add a comma and a space. Choose Date > Year > 2001 When you are done, the snippet content should be “%@+15D%B %e, %Y”, without the quotation marks. Give your snippet an abbreviation, such as “d15” or “payupnow”. Here is a list of the math macros used in TextExpander: %@+1Y = Add Year(s) %@+1M = Add Month(s) %@+1D = Add Day(s) %@+1h = Add Hour(s) %@+1m = Add Minute(s) %@+1s = Add Second(s) To subtract the value instead of add, change the plus “+” to minus “-”. To change the amount of value, change the “1” to another number. Los macros matemáticos de fecha y hora no son acumulativos. Macros matemáticos de fecha y hora se aplican a todos los formatos subsiguientes de fecha y hora. Si aparece otro macro matemático de fecha y hora en un fragmento, reemplaza el previo macro matemático de fecha y hora. Si suponemos por ejemplo que hoy es Septiembre 2013: "Un año a partir de hoy: %@+1Y%Y, más específicamente %B, %Y. Dos años a partir de hoy: %@+2Y%Y." expande a "Un año a partir de hoy: 2014, más específicamente Septiembre 2013. Dos años a partir de hoy: 2015." For more information on special characters and macros used in TextExpander, see Advanced Snippet Functions: Macros. |
| © 2006-2014 SmileOnMyMac, LLC, dba Smile. All rights reserved. TextExpander is a registered trademark, Smile and the Smile logo are trademarks of SmileOnMyMac, LLC, dba Smile. |