Why don't you just use DATE_FORMAT() in your query, then you don't have
to do any extra PHP code at all??

---John Holmes...

> -----Original Message-----
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 21, 2002 3:50 AM
> To: PHP-General Mailing List
> Subject: [PHP] Stumped on a function
> 
> I've been using the following function successfully for months,
tonight I
> literally copied/pasted it to another page I was creating, called it
> exactly
> the same using the same data type, and I'm getting an incorrect
result.
> The
> function is supposed to take a standard MySQL "CCYY-MM-DD" date format
and
> convert it to a "Month Day, CCYY" format. Here's the function code:
> 
> function cleandate($indate) {
>       str_replace("-", "/", $indate);
>       return date("F j, Y", strtotime($indate));
>       }
> 
> And I'm calling it with:
> 
> $newdate = cleandate($birthdate);
> 
> $birthdate is a MySQL DATE field and if I echo "$birthdate" I get
> "2002-11-04", which is what is entered for that $birthdate record.
> However,
> when I echo $newdate using the above code, I get "June 20, 2002" -
today's
> date.
> 
> Now, again I'm using this code as-is successfully on another page. I
don't
> understand why it's returning today's date on this page, but returning
the
> correct date on another page.
> 
> This is the error that PHP is throwing regarding the above code:
> [Thu Jun 20 23:16:38 2002] [error] PHP Warning:  strtotime() called
with
> empty time parameter in test.php on line 19
> 
> Line 19 is the 'return' line in the function. I do not get this error
in
> my
> successful application of this code.
> 
> Any ideas? Thanks in advance...
> 
> Jason Soza
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to