RE: [PHP-DB] Data / Time problem
| From: | Sam Masiello | Date: | Wed, 15 Nov 2000 20:36:21 +0000 |
| Subject: | RE: [PHP-DB] Data / Time problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-4452@lists.php.net to get a copy of this message | ||
If you know that the date returned in $fromMysql is a date in YYYYMMDD
format, why not just do something like this:
$year = substr($fromMysql, 0, 4) ;
$month = substr($fromMysql, 4, 2) ;
$day = substr($fromMysql, 6, 2) ;
$thedate = $year."/".$month."/".$day ;
HTH
Sam Masiello
System Analyst
Chek.Com
(716) 853-1362 x289
smasiello@chekinc.com
-----Original Message-----
From: kenji chan [mailto:kenjikenji@bigpond.com]
Sent: Wednesday, November 15, 2000 3:01 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Data / Time problem
Data / Time problem:
How to format a date from Mysql column ( timestamp(8) ) to "Year / Month /
Day" ?
I got a problem , For examlp :
*********
$fromMysql = "19811229";
echo date("Y / m / d", $fromMysql);
*********
I would like to see 1981 / 12 /29 ,but I got the result :
1970 / 08 / 18
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net