Add week in smarty tpl

Kārlis Millers
  • Output: 2015-01-20 03:52:19
  • Need 01.20.2015 + 1 week = 01.27.2015

I curently have {$order[orders].invoice_date|date_format:"%d.%m.%Y"}
But how to add week + 1?

So, I need to add 1 week and then formating this.
But the date isn't in the timestap format.

Smarty version: 3.1.
I can use only smarty logic, not PHP.

How to achieve this?

Bjoern

You don't need a plugin to work this out. It can be solved with a combination of cat and date_format.

Since date_format is a wrapper to PHPs strftime(), you can use the conversion specifiers available in strftime() - and that is what I used tackle the issue at hand.

Try this:

{$order[orders].invoice_date|cat:' +1 week'|date_format:"%d.%m.%Y"}

I've used Smarty version 3.1.17 to recreate your problem. The solution is based on the assumption that the value in your variable $order[orders].invoice_date is a string 2015-01-20 03:52:19.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Add week in smarty tpl

From Dev

Issues with .TPL file with Smarty

From Dev

smarty tpl file does not read the tpl file properly

From Dev

Using smarty template (*.tpl) what is {#name#}

From Dev

Passing Array from php to Smarty .tpl

From Dev

make a variable in smarty tpl using section

From Dev

Passing Array from php to Smarty .tpl

From Dev

Smarty gives Fatal error on editing .tpl file

From Dev

Is it possible to use smarty template without tpl file?

From Dev

add var in smarty for loop

From Dev

Safely add collection in TPL

From Dev

Whmcs call a php script in a tpl file using smarty variables

From Dev

Prestashop Smarty get order price after checkout header.tpl

From Dev

Add strip_tags exceptions in smarty

From Dev

how to add file php to tpl in scripts

From Dev

Year-Week add a week in r

From Dev

Smarty - How can i add "show more links tab"

From Dev

Smarty - How to add values from my form to mysql query?

From Dev

Smarty - How can i add "show more links tab"

From Dev

using TPL Dataflow, can I cancel all posts and then add one?

From Dev

EXTJS add fireEvent to dynamically created elements using tpl

From Dev

Java/Android Calendar, add 1 week on Sundays

From Dev

PHP - Add one week to a user defined date

From Dev

Add date of first day of week to date dimension

From Dev

Add local user with administrator rights and to be disabled in a week

From Dev

Fullcalendar - How to add time of the day in week view

From Dev

Add date of first day of week to date dimension

From Dev

MomentJS - Add month to date to specific day of week

From Dev

How to add days of the week x axis labels