DEV Community

dgloriaweb
dgloriaweb

Posted on

Smarty date and time formatting

Some examples of date formatting:

{$smarty.now|date_format}
Jun 15, 2022

__ with example date (eg. mysql returned format) __

{$myDate = "2022.06.15 11:01:54"}

{$myDate|date_format}
Jun 15, 2022

{$myDate|date_format:"%D"}
06/15/22

{$myDate|date_format:$config.date}
Jun 15, 2022

{$myDate|date_format:"%A, %B %e, %Y"}
Wednesday, June 15, 2022

{$myDate|date_format:$config.time}
Jun 15, 2022

Top comments (0)