Jump to content

how to add 1 year to a date in smarty


Safwen

Recommended Posts

Hi guys,

i would like to add 1 year to a dynamic date value in smarty.

i explain to add 1 year to the current date i use and worked well :

{"+1 year"|date_format:'%Y-%m-%d'}

 

now how to do that with a date value

{$account.date_add}

other thing how to do a difference between 2 dates in days.

thank you in advance.

Link to comment
Share on other sites

i have solved it with PHP and worked well like this :

 

$plusoneyear = date("Y-m-d", strtotime(date("Y-m-d", strtotime($this->context->customer->date_add)) . " + 365 day"));
 $this->context->smarty->assign('one',$plusoneyear);

 

but i would like to know how to do it in smarty ?

Link to comment
Share on other sites

  • 7 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...