RE: [PHP] mkdate error?
| From: | RPS Internet | Date: | Sun, 11 Aug 2002 23:08:35 +0000 |
| Subject: | RE: [PHP] mkdate error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112063@lists.php.net to get a copy of this message | ||
Your working with strings right? Would your if command be:
if ($start_dts gt $end_dts) {
echo "This function thinks the end date is older than the start date.";
}
else {
echo "Whoah, it actually worked.";
}
In string you should use the gt comparitive instead of the >.
See if this works for you,
Josh Thomas
RPS Internet Services
-----Original Message-----
From: jc [mailto:chyunj@uci.edu]
Sent: Sunday, August 11, 2002 4:01 PM
To: php-general@lists.php.net
Subject: [PHP] mkdate error?
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php