Re: [PHP] validating mysql bound date

2008-03-07 Thread Larry Brown
Doesn't checkdate() do the sanity check for a valid date? On Fri, 2008-03-07 at 10:08 -0600, Richard Lynch wrote: > Something like this, perhaps: > > preg_match('/^((19|20)[0-9]{2})-([0-1]?[0-9])-([0-3]?[0-9])$/', > $input, $date_parts); > var_dump($date_parts); > > This doesn't completely rule

Re: [PHP] validating mysql bound date

2008-03-07 Thread Richard Lynch
Something like this, perhaps: preg_match('/^((19|20)[0-9]{2})-([0-1]?[0-9])-([0-3]?[0-9])$/', $input, $date_parts); var_dump($date_parts); This doesn't completely rule out bogus dates such as 2008-02-30 however. I think MySQL would just convert that to MAR 1, 2008 anyway... But if you want that

Re: [PHP] validating mysql bound date

2008-03-05 Thread Daniel Brown
On Tue, Mar 4, 2008 at 8:16 PM, Larry Brown <[EMAIL PROTECTED]> wrote: > Does anyone know if there is a builtin function for checking the > formatting of an incoming date to verify it is /MM/DD. I know how > to convert between formats but want a quick way to check an incoming > variable to

Re: [PHP] validating mysql bound date

2008-03-04 Thread Larry Brown
Thanks, I ended up doing: $incomingQuestDatePieces = explode("-", $incomingQuestDate ); if(checkdate($incomingQuestDatePieces[1],$incomingQuestDatePieces[2], $incomingQuestDatePieces[0])) { return true; } else { return false; } I was just wondering since a lot of people have to

Re: [PHP] validating mysql bound date

2008-03-04 Thread Chris
Larry Brown wrote: Its been a long week already... -MM-DD. On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote: Does anyone know if there is a builtin function for checking the formatting of an incoming date to verify it is /MM/DD. I know how to convert between formats but want a quic

Re: [PHP] validating mysql bound date

2008-03-04 Thread Larry Brown
Its been a long week already... -MM-DD. On Tue, 2008-03-04 at 20:16 -0500, Larry Brown wrote: > Does anyone know if there is a builtin function for checking the > formatting of an incoming date to verify it is /MM/DD. I know how > to convert between formats but want a quick way to check a

[PHP] validating mysql bound date

2008-03-04 Thread Larry Brown
Does anyone know if there is a builtin function for checking the formatting of an incoming date to verify it is /MM/DD. I know how to convert between formats but want a quick way to check an incoming variable to ensure it will be handled properly by mysqld. Larry -- PHP General Mailing Lis