在我的mysql数据库中dateTime以下面的形式存储。将日期时间从mySql更改为php中的时间戳
00000-00-00 00:00:00
在我的PHP我想将其转换为tiemStamp形式是这样的。
136716425
我尝试使用
$date2->getTimestamp();
没有成功,我应该用什么功能来改变格式时间戳?
$sql = "SELECT * FROM temp_user";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$date1 = new DateTime();
$date2 = $row[dateTime];
echo $date1->getTimestamp();
echo $date2->getTimestamp();
}
[重复](http://stackoverflow.com/questions/4577794/how-to-convert-mysql-time-to-unix-timestamp-using-php) – 2013-04-28 16:01:03
即溶液在这种情况下不起作用。 >< – 2013-04-28 16:07:19