note 20596 deleted from function.time by jsheets
| From: | jsheets@php.net | Date: | Sun, 26 Jan 2003 05:41:16 +0000 |
| Subject: | note 20596 deleted from function.time by jsheets | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42751@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