Hi,
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 show 2010 25 05 12:12:12
Hi,
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 show 2010 25 05 12:12:12
Use the strtotime()
php function and assign your variable to smarty. Something like this:
<?php
$later = strtotime('+20 day');
$smarty->assign('later', $later);
?>
Then in the template:
{ $later|date_format:'%Y-%m-%d %H:%M:%S'}
{$smarty.now}
is a simple timestamp (number of seconds since 1970). So you can just add as many seconds to it as you need:
{$smarty.now+20*24*60*60|date_format:'%Y-%m-%d %H:%M:%S'} //+20 days
This works in Smarty3, if not in older versions then you might need to do the math with {assign}
and/or {math}
directives.