Here is what I am trying to do:
I need be able to skip forwards and backwards through timesheets using the end of week date for the timesheet currently being viewed.
Here is the problem:
with the following code, I can go forward, or go backward all I want. However, after going forward or backward, if I then try to go the opposite direction from the current page, it works correctly only if it does not cross a month. This week is an example. If someone goes back to view last week's time sheet and then forward to view this weeks again, it adds 1 day and give 6/6/04 as the end of week instead of 6/5/04. I am passing the endofweekfut or endofweekprev with a forward or backward link.
Here is the date code. Please help
Keep in mind that endofweek is not always going to be the current weeks end
$endofweek= 2004-06-05;
$endofweek= 2004-06-05;
$enddweek=strtotime($endofweek);
$endweek=getdate($enddweek);
$endofweekfut= date("m", mktime(0,0,0, date($endweek["mon"]), (date(($endweek["mday"]+7)), date("Y")))."/".
date("d", mktime(0,0,0, date($endweek["n"]), (date(($endweek["mday"]+7)), date("Y")))."/".
date("y", mktime(0,0,0, date($endweek["n"]), (date(($endweek["mday"]+7)), date("Y")));
$endofweekprev= date("m", mktime(0,0,0, date($endweek["mon"]), (date(($endweek["mday"]-7)), date("Y")))."/".
date("d", mktime(0,0,0, date($endweek["n"]), (date(($endweek["mday"]-7)), date("Y")))."/".
date("y", mktime(0,0,0, date($endweek["n"]), (date(($endweek["mday"]-7)), date("Y")));
;
Thanks
Niki