fenom/docs/en/mods/date_format.md

20 lines
700 B
Markdown
Raw Normal View History

2014-01-29 12:01:31 +04:00
Modifier date_format
====================
2013-02-09 10:59:08 +04:00
2014-01-29 12:01:31 +04:00
This formats a date and time into the given [strftime()](http://docs.php.net/strftime) format.
Dates can be passed to Fenom as unix timestamps, DateTime objects or any string made up of month day year, parsable by [strftime()](http://docs.php.net/strftime).
By default format is: `%b %e, %Y`.
2013-02-09 10:59:08 +04:00
```smarty
{var $ts = time()}
2018-03-15 18:20:44 +03:00
{$ts|date_format:"%Y/%m/%d %H:%M:%S"} outputs 2013/02/08 21:01:43
2014-01-29 12:01:31 +04:00
{$ts|date_format:"-1 day"} outputs 2013/02/07 21:01:43
2013-02-09 10:59:08 +04:00
{var $date = "2008-12-08"}
2018-03-15 18:20:44 +03:00
{$ts|date_format:"%Y/%m/%d %H:%M:%S"} outputs 2008/12/08 00:00:00
2014-01-29 12:01:31 +04:00
```
[Allowed quantificators](http://docs.php.net/strftime#refsect1-function.strftime-parameters) in **date_format**