How to format date variable in Smarty for dd/mm/YYYY

Asked

Viewed 64 times

1

I’m trying to format a date on Smarty that is in that format {$Grid.Row.DataEmissao.DisplayValue} being displayed like this: 15-03-2018, how can I format it for 15/03/2018 to display in my report, I even read some documents, but what I saw was this:

{$smarty.now|date_format}
{$smarty.now|date_format:"%A, %B %e, %Y"}
{$smarty.now|date_format:"%H:%M:%S"}
{$yesterday|date_format}
{$yesterday|date_format:"%A, %B %e, %Y"}
{$yesterday|date_format:"%H:%M:%S"}
MOSTRA:
Feb 6, 2001
Tuesday, February 6, 2001
14:33:00
Feb 5, 2001
Monday, February 5, 2001
14:33:00

But in my case, it doesn’t solve.

1 answer

1


Smarty uses some standard php functions for some things like in the case of dates strftime() the formatting rule is the same as in documentation

date_format is essentially a wrapper to PHP’s strftime() Function. You may have more or Less Conversion specifiers available Depending on your system’s strftime() Function Where PHP was Compiled.

{$smarty.now|date_format:"%d/%m/%Y"}
  • Excellent, thanks for the @rray tip.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.