Re: Formatting timestamp date in MySQL
| From: | ayukawa | Date: | Tue, 09 Apr 2002 12:19:12 +0000 |
| Subject: | Re: Formatting timestamp date in MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92213@lists.php.net to get a copy of this message | ||
Hello,
>The column is set as "date timestamp(8)".
>A sample of date is "20020409"
>
>I use the PHP Date function to format it back to say "9th April 2002".
>$date_formated = date($date, 'S M Y' );
How about this;
$date_formatted=date("jS M Y",mktime(0,0,0,substr($date,4,2),substr
($date,6,2),substr($date,0,4)));
However I guess this is proper 4 U;
$date_formatted=date("jS F Y",mktime(0,0,0,substr($date,4,2),substr
($date,6,2),substr($date,0,4)));
Hiroshi Ayukawa
http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php