Returns a formatted date.

 string date( string format [, int timestamp ])

Returns the date, formatted according to the rules of Java’s SimpleDateFormat class.

See the class documentation for the full list of letter codes; here are the most useful:

Letter Date or Time Component Examples
y Year 2012; 12
M Month in year July; Jul; 07
d Day in month 10
E Day in week Tuesday; Tue
a AM/PM marker PM
H Hour in day (0-23) 0
h Hour in am/pm (1-12) 12
m Minute in hour 30
s Second in minute 55

Pattern letters are usually repeated. The number of repetitions determines their presentation, add more or less repetitions to get more or less abbreviated names.

Example of a day of the week:

{date("E")}    --> Mon
{date("EEEE")} --> Monday

By default, the current date, or the send date of the message, is what is used.

{date('MMM dd, yyyy')} ---> Jul 30, 2012
{date('MM/dd/yyyy')}   ---> 07/30/2012
{date('MM/dd/yy')}      ---> 07/30/12


If you pass a secondĀ timestampparameter as a UNIX timestamp, it will format the date for that timestamp.

See theĀ time( )function for a way to generate such timestamps, for example:

{date('MMM dd, yyyy', time('Jul 15, 2012 +1 week'))} ---> Jul 22, 2012

In addition, you can use the date( ) dynamically in an email with the time( ). For example:

{date("MMM dd, yyyy", time("+1 day"))}  ---> tomorrow's date



Convert UNIX time to date when pulling from a data feed:

{date('MMM dd, yyyy', content[0].date)}