Re: simple question...

From: Date: Fri, 21 Sep 2001 04:36:55 +0000
Subject: Re: simple question...
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-67983@lists.php.net to get a copy of this message
One more thing... If I got '2001-09-01' Is there a fast way of incrementing the month of it? making it '2001-10-01' ? ----- Original Message ----- From: "* R&zE:" <renze@datalink.nl> To: "Ker Ruben Ramos" <kreaper@iligan.mine.nu>; <php-general@lists.php.net> Sent: Thursday, September 20, 2001 6:04 AM Subject: Re: [PHP] simple question... > <Original message> > From: Ker Ruben Ramos <kreaper@iligan.mine.nu> > Date: Thu, Sep 20, 2001 at 08:56:03PM -0700 > Message-ID: <00f801c14251$5aa288b0$bb05aacb@weblinqproxy> > Subject: [PHP] simple question... > > > ey guys.. how do i check if the postdata is a valid time format? something > > like '2001-09-15' > > I hate it when they'll be entering garbage in it... > > </Original message> > > <Reply> > > See the example below: > > --- PHP Example Code --- > <PRE> > <?php > > /* Valid date */ > $myDate = "2001-09-12"; > > /* Invalid date */ > //$myDate = "2001-13-20"; > > /* Another invalid date */ > //$myDate = "20o1-10-x9"; > > if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $myDate, > $matches)) { > if (checkdate ($matches[2], $matches[3], $matches[1])) { > print ("Valid date!\n\n"); > print (date ("r", mktime (0,0,0,$matches[2], $matches[3], > $matches[1]))); > } else { > print ("No valid date!"); > } > } else { > print ("No valid date!"); > } > > ?> > </PRE> > --- End of PHP Example Code --- > > </Reply> > > -- > > * R&zE: > > > -- »»»»»»»»»»»»»»»»»»»»»»»» > -- Renze Munnik > -- DataLink BV > -- > -- E: renze@datalink.nl > -- W: +31 23 5326162 > -- F: +31 23 5322144 > -- M: +31 6 21811143 > -- > -- Stationsplein 82 > -- 2011 LM HAARLEM > -- Netherlands > -- > -- http://www.datalink.nl > -- «««««««««««««««««««««««« > > -- > 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 (#67983) next »