Re: mkdate error?
| From: | Bas Jobsen | Date: | Sun, 11 Aug 2002 22:30:23 +0000 |
| Subject: | Re: mkdate error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112066@lists.php.net to get a copy of this message | ||
YOU use $parsed_date[2] in stead of $parsed_end_date[2]
Op maandag 12 augustus 2002 00:01, schreef jc:
> 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