Date Validation
| From: | TV Karthick Kumar | Date: | Tue, 09 Jan 2001 14:34:20 +0000 |
| Subject: | Date Validation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-33461@lists.php.net to get a copy of this message | ||
Hi all
I have some strange problem in Validating the date.
I am working on some web application which is like Events in an Address
book for our customers. The requirement is whenever the Event date is passed
today's date (crosses todays date), I should be able to allow the user
delete the particular event (record) and should be deleted.
Here's my script, it's very simple and I am not able to get the exact
results at all. Please help me.
<?
$td=date("d/m/Y");
echo $td;
echo "<br>";
$id='02/02/2001';
echo $id;
if ($td > $id) {
echo 'todays date is greater than id';
}
else
{
echo 'todays date is lesser than id';
}
?>
-- The above script always prints the first echo statement saying that
'todays date is greater than <$id's value>'. Why is that so ?. What's the
other way that I can validate this date ?.
Thanks in advance.
~ Karthick