小编Alo*_*ain的帖子

我如何在symfony2中将日期对象转换为时间

我正在使用Symfony2.从数据库中获取日期时,我需要在我的数据库中显示日期index.html.php.

当我打印它的显示如下: DateTime Object ( [date] => 2012-10-09 13:30:23 [timezone_type] => 3 [timezone] => UTC )

但是当我将对象转换为int时它的给出错误: $days2 = floor( $entities->getCreationDate() / (60 * 60 * 24));

Notice: Object of class DateTime could not be converted to int**
Run Code Online (Sandbox Code Playgroud)

datetime date symfony

1
推荐指数
2
解决办法
1万
查看次数

标签 统计

date ×1

datetime ×1

symfony ×1