|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bu_marius Smarty n00b
Joined: 20 Jan 2015 Posts: 2
|
Posted: Tue Jan 20, 2015 5:33 pm Post subject: $date + 2days |
|
|
Hello,
Can anybody help me please?
I'm trying to make in my tpl file $date + 2 days and I don't know how? I have spent 3hours and nothing.
Can anybody help me please?
I have a variable $manufacturing_date and I want to add 2 days to this variable in my tpl file.
{assign var='date1' value=($manufacturing_date|date_format:"%d/%m/%Y") }
{assign var='date2' value=($date1 +2 days) }
<span>{$date2|date_format:"%d/%m/%Y"}</span>
regards
marius |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jan 20, 2015 6:00 pm Post subject: |
|
|
Do that in your PHP code.
Smarty allowing you to do complex math is just a sideffect you should not rely upon. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sun Jan 25, 2015 4:10 am Post subject: |
|
|
If it is a timestamp:
$manufacturing_date + (86400 * 2) |
|
Back to top |
|
bu_marius Smarty n00b
Joined: 20 Jan 2015 Posts: 2
|
Posted: Mon Jan 26, 2015 3:59 pm Post subject: |
|
|
hello,
thank you for your reply.
finally I used the timestamp method directly in smarty.
I convert my manufacturing_date in timestamp and I apply +2 days (in seconds).
thanks again.
regards |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|