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....

eZ debug

Timing: Jan 30 2025 16:39:54
Script start
Timing: Jan 30 2025 16:39:54
Module start 'content'
Timing: Jan 30 2025 16:39:54
Module end 'content'
Timing: Jan 30 2025 16:39:55
Script end

Main resources:

Total runtime0.3479 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0084 587.9375370.2891
Module start 'content' 0.00840.0169 958.22661,005.5625
Module end 'content' 0.02530.3225 1,963.78913,893.5859
Script end 0.3479  5,857.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00471.3576200.0002
Check MTime0.00140.3994200.0001
Mysql Total
Database connection0.00070.193110.0007
Mysqli_queries0.236367.89881410.0017
Looping result0.00170.48031390.0000
Template Total0.322092.510.3220
Template load0.00090.258710.0009
Template processing0.321192.285310.3211
Override
Cache load0.00060.174510.0006
Sytem overhead
Fetch class attribute can translate value0.00190.538610.0019
XML
Image XML parsing0.00030.077010.0003
General
dbfile0.01333.8153200.0007
String conversion0.00000.001830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs