CavemanUK Posted May 21, 2008 Share Posted May 21, 2008 hi, I have a calendar up and running that shows my itinerary for a given date... i dont know if its the correct way to do it but basically if no argument is passed to it, it shows todays events. or i can pass a date to it (eg.. calendar.php?DisplayDate=2008-02-21).. I would like to put navigation on the page so i can move forward or backwards a day but i havent a clue how i would make it work? is there an easy calculation that would that the date value and add/remove a day from it and would it be good practice for it to simply reload the page with the new argument? also, Im using a table for displaying the events.. is it possible to make the <td> cells clickable so i cant make it interactive? Thanks guys CavemanUK Link to comment https://forums.phpfreaks.com/topic/106670-navigating-an-event-calendar/ Share on other sites More sharing options...
nloding Posted May 21, 2008 Share Posted May 21, 2008 Based on the date you're showing, add or subtract a day for the link -- and the link would point to calendar.php?DisplayDate=[new date here]. http://www.koonming.com/blog/php-datetime-add-and-subtract/ Link to comment https://forums.phpfreaks.com/topic/106670-navigating-an-event-calendar/#findComment-546765 Share on other sites More sharing options...
CavemanUK Posted May 21, 2008 Author Share Posted May 21, 2008 Those functions look exactly like what i need.. i was wondering how to format the date to pass to them... eg.. the date i have is in a string passed from the argument (eg. "2008-02-21")..so in code it its like... $mydate = "2008-02-21"; // obviously this is normally pulled from the argument $dayafter = date(DateAdd("d",1,$mydate)); $daybefore = date(DateSubtract("d",1,$mydate)); // Sorry was wrong before but it doesnt seem to work correctly and returns completely the wrong date... im probably passing the wrong date info but i don't understand what im doing wrong. Link to comment https://forums.phpfreaks.com/topic/106670-navigating-an-event-calendar/#findComment-546783 Share on other sites More sharing options...
nloding Posted May 21, 2008 Share Posted May 21, 2008 http://www.w3schools.com/PHP/php_date.asp OR http://us3.php.net/date Link to comment https://forums.phpfreaks.com/topic/106670-navigating-an-event-calendar/#findComment-546823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.