date_format

1.0 1.1 1.2 1.3

Formats a date

<?php
date_format(string $value, [ string $format = '%b %e, %Y', [ mixed $default = null ]])
  • value: the date, as a unix timestamp, mysql datetime or whatever strtotime() can parse
  • format: output format, see http://php.net/strftime for details
  • default: a default timestamp value, if the first one is empty

Examples

Example #1

index.tpl
{$.now}
{date_format $.now "%Y-%m-%d"}
{date_format $.now "%D"}
{date_format "1994-3-15 10:24:22"}

The above example will output:

1211992444
2008-05-28
05/28/08
Mar 15, 1994