note 20596 added to function.time
| From: | davidly-job at altern dot org | Date: | Tue, 09 Apr 2002 13:24:20 +0000 |
| Subject: | note 20596 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29014@lists.php.net to get a copy of this message | ||
You can use the following function to convert Mysql TimeStamp to Unix TimeStamp (Modify it at your
convenience, I let the array since you might want to return an array with this function as well) :
function convert_time($mysql_timestamp){
// YYYYMMDDHHMMSS
if (ereg("^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})
([0-9]{2})",$mysql_timestamp,$res)):
$info["year"]=$res[1];
$info["month"]=$res[2];
$info["day"]=$res[3];
$info["hour"]=$res[4];
$info["min"]=$res[5];
$info["sec"]=$res[6];
return(mktime($info["hour"],$info["min"],$info["sec"],
$info["month"],$info["day"],$info["year"]));
else:
return(false);
endif;
}
David Ly - http://davidly.cjb.net
--
http://www.php.net/manual/en/function.time.php
http://master.php.net/manage/user-notes.php?action=edit+20596
http://master.php.net/manage/user-notes.php?action=delete+20596
http://master.php.net/manage/user-notes.php?action=reject+20596