After a moment of inspiration, the solution to my question became obvious (I was riding my bike). Part "$ now"
strtottime( string $time {,int $now ])
must be set as the current date. Not "$ time () - now", but "the current date I'm associated with // I'm looking at my journal.
ie: if I look at the schedule summary for 8/10/2008, then it is "now" according to strtotime (); Yesterday - 8/09, and tomorrow - 8/11. Once I sneak up once, "now" - 8/11, yesterday - 8/10, and tomorrow - 8/12.
Here is a sample code:
<?php //catch variable $givendate=$_GET['given']; //convert given date to unix timestamp $date=strtotime($givendate); echo "Date Set As...: ".date('m/d/Y',$date)."<br />"; //use given date to show day before $yesterday=strtotime('-1 day',$date); echo "Day Before: ".date('m/d/Y',$yesterday)."<br />"; //same for next day $tomorrow=strtotime('+1 day',$date); echo "Next Day: ".date('m/d/Y',$tomorrow)."<br />"; $lastmonday=strtotime('last monday, 1 week ago',$date); echo "Last Moday: ".date('D m/d/Y',$lastmonday)."<br />"; //form echo "<form method=\"get\" action=\"{$_SERVER['PHP_SELF']}\">"; //link to subtract a day echo "<a href=\"newtimetravel.php?given=".date('m/d/Y',$yesterday)."\"><< </a>"; //show current day echo "<input type=\"text\" name=\"given\" value=\"$givendate\">"; //link to add a day echo "<a href=\"newtimetravel.php?given=".date('m/d/Y',$tomorrow)."\"> >></a><br />"; //submit manually entered day echo "<input type=\"submit\" name=\"changetime\" value=\"Set Current Date\">"; //close form echo "<form><br />"; ?>
By clicking on the button "<lt; and" β "advances and retreats that day.
kevtrout
source share