I have a parameter in my page called 'priceValidUntil', for this parameter I have the line:
<meta itemprop="priceValidUntil" content="{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}">
I want to add to the $smarty.now
value 15 days, so I've added this:
<meta itemprop="priceValidUntil" content="{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S' + 15 }">
The output is this:
<meta itemprop="priceValidUntil" content="2024-04-27 23:04:05">
I want:
<meta itemprop="priceValidUntil" content="2019-05-12 23:04:05">
How can I add days instead of years?
According to this link, it seems you might be able to do so, maybe by adding:
{$smarty.now+24*60*60*15|date_format:'%Y-%m-%d %H:%M:%S'}
to your content
attribute.
In the numbers, 24 is hours, one of 60 stands for minutes and the other 60 stands for seconds, times by 15 days, is to calculate the seconds that you wish to add to $smarty.now
variable.
Then, your code may look like:
<meta itemprop="priceValidUntil" content="{$smarty.now+15*24*60*60|date_format:'%Y-%m-%d %H:%M:%S'}">
You might simply try this:
{"+15 days"|strtotime|date_format:'%Y-%m-%d %H:%M:%S'}
Then, your code might look like:
<meta itemprop="priceValidUntil" content="{$smarty.now+1296000|date_format:'%Y-%m-%d %H:%M:%S'}">