The I "now" get a date from MySQL (hehe) is to use UNIX_TIMESTAMP then feed
it over to date.

That way if I want to change the way the date is displayed, I don't have to
touch my query syntax. And I personally find it easier to use PHP's date()
function rather than MySQL's.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Chris Adams" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On 14 Apr 2001 17:31:02 -0700, DRN <[EMAIL PROTECTED]> wrote:
> >$date = $row["date"];
> >
> >$new_date = date("l, j M Y, G:i:s", strtotime($date));
> >~~
> >
> >but I cannot get this to work :(, I get an "unexpected error in
> >date()"
>
> At a guess strtotime() is choking on the format MySQL used to return the
date,
> which would lead date() to fail as well.
>
> The best way of handling this is to eliminate the need for your program to
> worry about the day formats. Modify your mysql query so that instead of
"SELECT
> date" you have something like "SELECT UNIX_TIMESTAMP(date) AS date". Then
you
> can simply use date($row["date"]) directly. Alternately, you could use
MySQL's
> date formatting function to return the desired format directly. In either
case,
> you'll save a great deal of trouble by avoiding the need for PHP and MySQL
to
> be parsing each other's human-readable date formats.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to