Php 尝试将MysQl时间戳转换为时间之前时,无法分析时间字符串

Php 尝试将MysQl时间戳转换为时间之前时,无法分析时间字符串,php,mysql,datetime,strtotime,Php,Mysql,Datetime,Strtotime,我试图将MysQl时间戳转换为显示时间之前的内容,但我遇到了这个错误 致命错误:未捕获的异常“exception”带有消息 'DateTime::\构造():无法分析时间字符串(149324845) 脚本 <?php //convert timestamp to time ago $start_date = new DateTime(); $time = strtotime($streamuser['Datetime']); $dbDate = new DateTime($time);

我试图将MysQl时间戳转换为显示
时间之前的内容
,但我遇到了这个错误

致命错误:未捕获的异常“exception”带有消息 'DateTime::\构造():无法分析时间字符串(149324845)

脚本

<?php 
//convert timestamp to time ago
$start_date = new DateTime();
$time = strtotime($streamuser['Datetime']);
$dbDate = new DateTime($time);
$currDate = new DateTime();
$interval = $currDate->diff($dbDate);
?>
<span><?php  echo $interval->d." days ".$interval->h." hours";?></span>

MysQl时间戳格式为
2017-04-27 22:27:25


我做错了什么?

我之所以出错,是因为我试图解析date_diff()需要datetime对象的字符串。这对我很有用:

   <?php 
    //convert timestamp to time ago
    $dbDate =$streamuser['Datetime'];
    $date = new DateTime($dbDate);
    $now = new DateTime();
   ?>
   <span style="font-size:smaller;">
   <?php  echo $date->diff($now)->format("%d days, %h hours and %i minutes");?> ago</span>

以前