note 59388 deleted from function.time by bjori
| From: | bjori@php.net | Date: | Tue, 28 Mar 2006 09:21:44 +0000 |
| Subject: | note 59388 deleted from function.time by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106829@lists.php.net to get a copy of this message | ||
Note Submitter: walter dot php at gmail dot com
----
Well, if you need to convert a Mysql Timestamp to a Unix timestamp without use the function
UNIX_TIMESTAMP in Mysql, you can use the code snippet below:
<?
function format_data($mysql_timestamp){
preg_match('/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/',
$mysql_timestamp,$pieces);
$unix_timestamp = mktime($pieces[4], $pieces[5], $pieces[6],
$pieces[2], $pieces[3], $pieces[1]);
return($unix_timestamp);
}
?>