Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

smarty and date

Tags:

smarty

i get date with: {$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}

But how get 20 day after?

If now: 2010 05 05 12:12:12, I wish to show 2010 25 05 12:12:12

like image 971
lolalola Avatar asked Jul 14 '10 17:07

lolalola


People also ask

How can I get current date in Smarty?

To display a date in your publications, you use the smarty. now function. This function calculates the number of seconds that have passed since 1-1-1970. The date_format modifier is then used to convert these seconds to a human readable value.


1 Answers

You can use strtotime() directly as a modifier.

{"+20 days"|strtotime|date_format:"Y/m/d"}
like image 119
mohrt Avatar answered Sep 28 '22 09:09

mohrt