note 51732 deleted from function.time by aidan
| From: | aidan@php.net | Date: | Sat, 08 Oct 2005 01:03:37 +0000 |
| Subject: | note 51732 deleted from function.time by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96608@lists.php.net to get a copy of this message | ||
Note Submitter: neoyahuu at yahooku dot com
----
i decide to create a function for converting MySQL timestamp(14) to datetime..
function datetime($YYYYMMDDHHMMSS) {
list($year,$month,$day,$hour,$minute,$seconds) =
sscanf($YYYYMMDDHHMMSS,'%4s%2s%2s%2s%2s%2s');
return date('Y-m-d h:i:s', mktime($hour,$minute,$seconds,$month,$day,$year));
}
echo datetime("20040422090941");
//output 2004-04-22 09:09:41