Skip to content
Umakant Patil edited this page Aug 14, 2017 · 2 revisions

This formats a date and time into the given strftime() format. Dates can be passed to Smarty as unix timestamps, DateTime objects, mysql timestamps or any string made up of month day year, parsable by php's strtotime(). Designers can then use date_format to have complete control of the formatting of the date. If the date passed to date_format is empty and a second parameter is passed, that will be used as the date to format.

This modifier uses JavaScript port of PHP function strftime() and strtotime(). You can find them at phpjs.org

This formats a date and time into the given strftime() format. Dates can be passed to Smarty as unix timestamps, mysql timestamps or any string made up of month day year, parsable by php's strtotime(). If you pass string made up of month date year, then it makes use of JavaScript port of PHP function strtotime().

Parameter Position Type Required Default Description
1 string No %b %e, %Y This is the format for the outputted date.
2 string No n/a This is the default date if the input is empty.

see also date_format in PHP Smarty documentation

Clone this wiki locally