Kuba
Kuba

Reputation: 189

Smarty date variable. Add days, change format

I have a question about the date format in smarty.

I got a smarty variable: [{ $order->oxorder__oxorderdate->value }]

This variable give me: 2013-03-10 10:45:17

Now I want do add 14 days, remove the time and change the format of the date:

So my wish is now to get this: 24.03.2013

Is this possible and how can i do this directly in the smarty/.tpl file?

Thank you for help and greetings!

Upvotes: 2

Views: 8873

Answers (2)

Vincent Guesné
Vincent Guesné

Reputation: 776

I think a found a food way to do that :

{assign var="date" value= $order->oxorder__oxorderdate->value|@strtotime + (60*60*24*7)}
{assign var="date2" value=$date|date_format:"%d/%m/%Y"}
{$date2}

Change 7 value par the day you want ;-)

Upvotes: 1

sofl
sofl

Reputation: 1024

Tested in Smarty 3

{"$order->oxorder__oxorderdate->value +14 Days"|date_format:'d.m.Y'}

Upvotes: 3

Related Questions