PHP日期转换为unix-timestamp

时间:2014-11-05 10:05:38

标签: php date unix-timestamp type-conversion

如何将此2014-11-03 17:01:37转换为Unix时间戳? 有没有我可以使用的方法。

4 个答案:

答案 0 :(得分:0)

使用 - strtotime()

$date = "2014-11-03 17:01:37";
echo strtotime($date);

答案 1 :(得分:0)

strtotime('2014-11-03 17:01:37')

答案 2 :(得分:0)

您可以创建DateTime对象:

$time = new DateTime("2014-11-03 17:01:37");
$time->getTimestamp();

答案 3 :(得分:0)

PHP为此目的有一个function strtotime

echo strtotime("2014-11-03 17:01:37");