note 18994 added to function.mktime
| From: | info at t4is dot nl | Date: | Tue, 12 Feb 2002 22:08:08 +0000 |
| Subject: | note 18994 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26527@lists.php.net to get a copy of this message | ||
convert a MySQL datetime field to an unix_timestamp
// MySQL datetime input returns unix_timestamp
function totime($buffer) {
$timestamp = mktime(substr($buffer,11,2), substr($buffer,14,2), substr($buffer,17,2),
substr($buffer,5,2), substr($buffer,8,2), substr($buffer,0,4));
return($timestamp);
}
now you can use it in :
date("M D Y",totime($result[1]));
--
http://www.php.net/manual/en/function.mktime.php
http://master.php.net/manage/user-notes.php?action=edit+18994
http://master.php.net/manage/user-notes.php?action=delete+18994
http://master.php.net/manage/user-notes.php?action=reject+18994