Re: A better way?

From: Date: Tue, 28 Nov 2000 23:07:06 +0000
Subject: Re: A better way?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27717@lists.php.net to get a copy of this message
There are builtin functions that will help. If nothing else: $dateparts = explode('/', $date); $checkdate = mktime(0, 0, 0, $dateparts[0], $dateparts[1], $dateparts[2]); if ($date != date('m/d/y')){ #bad date } ----- Original Message ----- From: Todd Cary <todd@aristesoftware.com> Newsgroups: php.general Sent: Friday, November 24, 2000 11:11 PM Subject: [PHP] A better way? > I need to check if a date is correct. The date is in the format of > mm/dd/yy. This is how I am doing it and I would like to take advantage > of those that have more experience doing this. > > Many thanks.... > > Todd > > $parts = explode("/", $TripDate); > if ($parts[2]) { > $parts[2] = "20" . $parts[2]; > }; > if (checkdate($parts[0], $parts[1], $parts[2])) { > $badDate = 0; > } else { > $badDate = 1; > }; > > > -- > Todd Cary > Ariste Software > todd@aristesoftware.com > > > > -- > 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 (#27717) next »