Problem with date functions
Posted: Thu Oct 26, 2006 1:30 am
Hi all-
I'm having a bit of a rough time debugging a chunk of code from an application written by someone who's currently out of contact... it's a calendar-based application allowing with forms in each day, allowing people to select specific sets of options. This has been having an ongoing glitch which revolves around the date function - specifically the following block of code:
It's not necessarily that this code has a specific syntax error as it is that I'm having difficulty deciphering how it works. It's part of a block of code that makes users unable to alter their food selections two weeks from the present date. I've looked up a lot about date functions on php.net, and I've figured out a bit about it, but as I said, something about how this works isn't clicking - I was hoping someone could explain it a little bit further.
Thanks!
I'm having a bit of a rough time debugging a chunk of code from an application written by someone who's currently out of contact... it's a calendar-based application allowing with forms in each day, allowing people to select specific sets of options. This has been having an ongoing glitch which revolves around the date function - specifically the following block of code:
Code: Select all
$datetemp = getdate();
if ($_POST['eday'] && $month_num != $datetemp['mon']) {
$eday = $_POST['eday'];
$edayend = $_POST['edayend'];
$edayend = $edayend-$eday;
} else {
$todaytemp = $datetemp['mday'];
$weekdaytemp = $datetemp['wday'];
if ( $weekdaytemp == 0) { $todaytemp +1; }
$eday = $todaytemp+5;
$edayend = $eday+5;
while ($weekdaytemp > 1 ) {
$weekdaytemp--;
$todaytemp--;
}
}Thanks!