Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Symfony 2日历包,从字符串创建日期时间_Php_Symfony_Datetime_Calendar - Fatal编程技术网

Php Symfony 2日历包,从字符串创建日期时间

Php Symfony 2日历包,从字符串创建日期时间,php,symfony,datetime,calendar,Php,Symfony,Datetime,Calendar,我正在为我的Symfony2项目使用 我想在日历中添加一个事件,例如: $date = new \DateTime('2014-12-16 17:00:00'); $eventEntity = new EventEntity("name of my event", $date, null, true); $calendarEvent->addEvent($eventEntity); 有了这些行,我可以添加en事件,没有问题 但当我试图从数据库中添加avent时,我遇到了问题。我的实体中有

我正在为我的Symfony2项目使用

我想在日历中添加一个事件,例如:

$date = new \DateTime('2014-12-16 17:00:00');
$eventEntity = new EventEntity("name of my event", $date, null, true);
$calendarEvent->addEvent($eventEntity);
有了这些行,我可以添加en事件,没有问题

但当我试图从数据库中添加avent时,我遇到了问题。我的实体中有一个字段datetime,因此我尝试了以下方法:

$date = new \DateTime($item->getMyDateTime());
这不起作用,我不知道如何在数据库中使用datetime来添加en事件。

我的错,只是:

$date = $item->getMyDateTime();