SMARTY - how to add days in variable to date?

1.3k Views Asked by At

I want to add to $order->date_add which is date, additional days. Number of days is in variable $order->days i have code like this

{$order->date_add|cat:' +60 days'|date_format:"%d-%m-%Y"}

but i want to replace number '60' by variable $order->days. Unfortunetly i can't do it in php - I must make it in smarty. Is it possible? How to replace that 60 by variable?

1

There are 1 best solutions below

0
brzlvch On

In what format do you have a date in {$ order-> date_add}?

If there is a timestamp, you can do this:

{$order->date_add+20*24*60*60|date_format:"%d-%m-%Y"} //+20 days

or

{$order->date_add + $order->days|date_format:"%d-%m-%Y"} // + {$order->days} days