Forums / Developer / how to add 1 day to current date

how to add 1 day to current date

Author Message

meriam santos

Thursday 05 November 2009 5:13:16 pm

i have this question on date on how to get tomorrows daycurrentdate() - will give you date todayhow about date tomorrow.currently working on agenda template and need to display the events tomorrow.hope somebody guides me on how to do this.BTW thanks heaps to Andre for the Agenda template.thanks...

meriam santos

Thursday 05 November 2009 7:09:13 pm

additional. this will be needed to display tomorrows event in the agenda template.

H-Works Agency

Friday 06 November 2009 3:38:07 am

You can easily do it with php's built-in function :

$new_date = date('d/m/y', strtotime('10/01/09' . " + 1 day"));

EZP is Great

Radek Kuchta

Friday 06 November 2009 7:15:20 am

I think that Meriam wants to get this date in a templat.

If yes, you can use currentdate operator:

<span class="line">{def $now = currentdate()}
{def $tommorow = $now|sum( 86400 )}
</span>

http://ez.no/certification/verify/272582

Luc Chase

Friday 06 November 2009 9:30:05 pm

{currentdate()|sum(mul(60,60,24,1))|l10n( 'shortdate' )}

Change final value in mul() according to number of days forwards or backwards you want to go. Part days allowed e.g. 1.5 days

The Web Application Service Provider

Kristof Coomans

Saturday 07 November 2009 6:25:06 am

Instead of doing arithmetics on a timestamp, you can also use a combination of the currentdate(), datetime(), and the makedate() template operators:

{def $currentDate=currentdate()
     $currentMonth=$currentDate|datetime('custom', '%n')
     $tomorrowDay=$currentDate|datetime('custom', '%j')|sum(1)
     $tomorrowDate=makedate($currentMonth, $tomorrowDay)}

<strong>{$tomorrowDate|l10n('shortdate')}</strong>

{undef $currentDate $currentMonth $tomorrowDay $tomorrowDate}

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

meriam santos

Sunday 08 November 2009 2:01:37 pm

Thanks all for the Reply. i was going to use this to display tomorrows event in the agenda template.My next question is that - anybody there successful in displaying tomorrows event in the Agenda template instead of the Whole months event. i just need the Todays event (this is succesful)and Tomorrows Event(problematic one)of the calendar. got stuck on this the dont know how to move on.would really apreciate any reply.thanks....