mkdate error?
| From: | jc | Date: | Sun, 11 Aug 2002 22:01:07 +0000 |
| Subject: | mkdate error? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-112062@lists.php.net to get a copy of this message | ||
The following bit of code completely baffles me as to why it doesn't work.
I am doing a very simple validation where I check to see if the "end date"
field of an inputted record is an older date than the "start date".
I checked this by putting in the same date for both end and start dates. Yet
mkdate gives me a different value for each even though since they are both
the same date, I should get the same value returned. Right?
//notice the start and end date is the same. Therefore, you should get the
same value for each, right?
<START LITTLE CODE SNIPPET>
$parsed_start_date=split("/", "08/02/2002");
$parsed_end_date=split("/", "08/02/2002");
$start_dts = mktime("", "", "", $parsed_start_date[0],
$parsed_start_date[1], $parsed_start_date[2]);
$end_dts = mktime("", "", "", $parsed_end_date[0],
$parsed_end_date[1],
$parsed_date[2]);
if ($start_dts > $end_dts) {
echo "This function thinks the end date is older than the start date.";
}
else {
echo "Whoah, it actually worked.";
}
<END LITTLE CODE SNIPPET>
What am I not seeing?
Thanks in advance,
J. Chyun