Re: Date Validation

From: Date: Tue, 09 Jan 2001 16:12:49 +0000
Subject: Re: Date Validation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33474@lists.php.net to get a copy of this message
Hi Just a suggestion ... try using mktime to generate the timestamp for the dates and then evaluate them as such eg. for today's timestamp: $td = mktime( 0,0,0, date('m'), date('d'), date('Y') ) break up the incoming date list ($day, $month, $year) = split ('[/.-]', $datetocheck ); $id = mktime( 0,0,0,$month, $day, $year ) then you can use the evaluation '$td > $id' ----- Original Message ----- From: TV Karthick Kumar <tvkarthick@myrealbox.com> To: <php-general@lists.php.net> Sent: Tuesday, January 09, 2001 4:34 PM Subject: [PHP] Date Validation > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#33474) next »