Date change: +1 days, +1 month or +1 years

I want to display date in the future, for example +10 days or +6 month, ect.!

{$date|date_format:$settings.Appearance.date_format}
```<br />
<br />
Can someone maybe help me? Thank you.

$date is a timestamp (I.e. Unix Timestamp - seconds since Jan 1, 1970 @ midnight).

So you would want to adjust $date by doing something like:

{math var=“date” expr=“x+y” x=$date y=$smarty.const.SECONDS_IN_DAY}

to get 1 day ahead… Put this above your {$date|format…} line.

[quote name='tbirnseth' timestamp='1326495680' post='129336']

$date is a timestamp (I.e. Unix Timestamp - seconds since Jan 1, 1970 @ midnight).

So you would want to adjust $date by doing something like:

{math var=“date” expr=“x+y” x=$date y=$smarty.const.SECONDS_IN_DAY}

to get 1 day ahead… Put this above your {$date|format…} line.

[/quote]

Thank you for your answer, but I unfortunately do not come forward.

Can you explain more precisely, where will I use. For example, 14 days (14 * 60 * 60 * 24) (days * seconds * minutes * hours)



{math var="date" expr="x+y" x=$date y=$smarty.const.SECONDS_IN_DAY}
{$date|date_format:$settings.Appearance.date_format}


Here is a error"… error: missing parameter equation"

Thanks

Sorry, was responding off the top of my head. Was hoping you'd take it as a concept rather than an absolute solution. Suggest you search for the Smarty manual to get the attributes correct for the 'math' function and I'd assume from the error that 'expr' should be 'equation'.

Perhaps I was not very evident. I would like to send in your addon “Auto Mailer” for customers with a date (+ “1 …” days, weeks).

I hope you understand me better now.

Can you help me! Thank you!

Actually, I have no idea what you want now at all… My Auto Mail addon wasn't even mentioned before this.



If you want to set a date for sometime in the future and have that displayed in a date format, there are as many ways to do this as there are programmers. What I would do then is:

{assign var=“my_tomorrow” value=“tomorrow”|strtotime|date_format:$settings.Appearance.date_format}



The PHP strtotime() function will parse almost any string you can give it into a timestamp. I.e. “yesterday”, “15th of next month”, “2 days”, etc… Google it for info.

Thank for your help. So simple and yet so difficult. I have installed in your auto-mailer and now works well. Thank you again. For anyone looking for that too, this is the code!


{assign var="my_time" value="+2 days"|strtotime|date_format:$settings.Appearance.date_format}
{$my_time|date_format:$settings.Appearance.date_format}


Only <<< “2 days”>>>simply change “next week” , “2 month” or “2 days” etc.

You don't need your second line since {$my_time} is already in the date format set for $settings.Appearance.date_format.