note 59388 added to function.time
| From: | walter dot php at gmail dot com | Date: | Mon, 05 Dec 2005 16:50:53 +0000 |
| Subject: | note 59388 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99594@lists.php.net to get a copy of this message | ||
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);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59388
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59388&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59388&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59388&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59388&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59388&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59388&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59388&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59388&report=yes
Search -- http://master.php.net/manage/user-notes.php