Jump to content

how to add 1 year to a date in smarty


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


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

thank you in advance.

Share this post

Link to post
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"));


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

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More