Placeholder Modifiers
- format(OPTIONS)
- Publishes a date field with a custom format. You can add this modifier to format supported date fields. The field will be published with the format specified in the "OPTIONS".
If you want to change the default date format used program-wide, see the program's documentation.
Example:
If $foo.date$ would ordinarily display, "2006-01-06 - 01:15 AM", we could instead have it output, "January 5th, 2006, 1:15 AM" by changing the placeholder to:
$foo.date:format(MMMM ddd, yyyy, h:mm tt)$
Important: when using format with other modifiers (see Chaining Modifiers), the format modifier MUST be the first modifier added to the placeholder. Multiple format modifiers will have no additional effect.
| Valid: | $bar.date:format(MM/dd/yy):html_encode$ |
Valid: | $bar.date:format(MMM ddd, yy):uppercase:urlEncoded$ |
 |
| Invalid: | $bar.date:html_encode:format(MM/dd/yy)$ |
| Invalid: | $bar.date:format(MMM d, yy):html_encode:format(MM/dd/yy)$ |
Additionally, this modifier is only valid on date placeholders as set by the program (it won't work on a regular placeholder that happens to contain a date value).
format options:
| | notation | description | example |
| Year | yy | 2 digit year (zero padded) | 06 |
| | yyyy | 4 digit year | 2006 |
| Month | MMMM | Full month name | January |
| | MMM | Short month name | Jan |
| | MM | Month number (zero padded) | 01 |
| | M | Month number | 1 |
| Weekday | wwww | Full weekday name | Tuesday |
| | www | Short weekday name | Tue |
| Day | ddd | Ornate day of month | 2nd |
| | dd | Day of month (zero padded) | 02 |
| | d | Day of month | 2 |
| 24 Hour | HH | Hour of day (24h, zero padded) | 03 |
| | H | Hour of day (24h) | 3 |
| 12 Hour | hh | Hour of day (12h, zero padded) | 04 |
| | h | Hour of day (12h) | 4 |
| | tt | AM or PM | AM |
| | t | AM or PM (short form) | A |
| | ttt | AM/PM as a numeric value (0 for AM, 1 for PM) | 0 |
| Minute | mm | Minute of hour (zero padded) | 05 |
| | m | Minute of hour | 5 |
| Second | ss | Second of minute (zero padded) | 06 |
| | s | Second of minute | 6 |
| Epoch | epoch | Seconds since epoch (1970) | 1062201058 |
| Program/User Defined |
These options (date_only, time_only, date_and_time) will format the date placeholder using the default format the user has set in the program's options. See the program documentation for more info.
|
| | date_only | Date only, format as defined in the program | Jan 1, 2004 |
| | time_only | Time only, format as defined in the program | 14:52 |
| | date_and_time | Full date & time, format as defined in the program | Jan 1, 2004 - 14:52 |
| Backslash | \\ | Display a backslash character (otherwise it will "escape" the next character, as below). |
| Escape* | \ | Don't format next character (i.e. "\Mon\t\h: MMM" would generate "Month: Feb") |
*Since many common letters are used in format options, if you wish to use any of those letters as words you'll need to tell the program to ignore them by using a backslash before them.
|
Example:
Below are examples of common format combinations:
| example |
format |
| Wednesday, January 5th, 2006 |
wwww, MMMM ddd, yyyy |
| January 5, 2006 |
MMMM d, yyyy |
| Wednesday, Jan 5, 11:00 PM |
wwww, MMM d, h:mm tt |
| 1/5/2006 11:00 PM |
M/d/yyyy hh:mm tt |
| 1/5/06 23:00 |
M/d/yy HH:mm |
| 01/05/06 |
MM/dd/yy |
| 5-Jan-06 |
d-MMM-yy |
|