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
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
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
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
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
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
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
7 matches
Mail list logo