formatting a date from mysql

formatting a date from mysql

am 12.12.2005 13:26:20 von Eternity Records Webmaster

I need to figure out how to format the date format: year-month-day
(2005-12-06). It is a date(8) field in a mysql table that i pulled out of
the table with php 5.0.5. I need it in the format: Tue December 6, 2005 (or
in mysql's formatting: 6-12-2005). I am using the reformatting for display
only. So it would be something like this:

echo $journal['Date']; //with whatever formatting needed

If possible I need php to do the formatting for me. Thanks...

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

Re: formatting a date from mysql

am 12.12.2005 13:42:13 von Adrian Bruce

farily straight forward to withinn the query itself, check out

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functio ns.html

or for php

http://uk.php.net/date

RTFM

Regards
Adrian

Eternity Records Webmaster wrote:

>I need to figure out how to format the date format: year-month-day
>(2005-12-06). It is a date(8) field in a mysql table that i pulled out of
>the table with php 5.0.5. I need it in the format: Tue December 6, 2005 (or
>in mysql's formatting: 6-12-2005). I am using the reformatting for display
>only. So it would be something like this:
>
>echo $journal['Date']; //with whatever formatting needed
>
>If possible I need php to do the formatting for me. Thanks...
>
>
>

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

Re: formatting a date from mysql

am 12.12.2005 17:15:43 von El Bekko

Eternity Records Webmaster wrote:
> I need to figure out how to format the date format: year-month-day
> (2005-12-06). It is a date(8) field in a mysql table that i pulled out of
> the table with php 5.0.5. I need it in the format: Tue December 6, 2005 (or
> in mysql's formatting: 6-12-2005). I am using the reformatting for display
> only. So it would be something like this:
>
> echo $journal['Date']; //with whatever formatting needed
>
> If possible I need php to do the formatting for me. Thanks...

An easy way to do it:

explode("-",$date);
$journal['Date'] = $date[2] . "-" . $date[1] . "-" . $date[0];
?>

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