I want to save a datetime in the database which was created with the doctrine schema tool. In my form I set a date and time and i want to save it as a datetime in the database.
So i tried this:
$e->setStartDateTime(new Zend_Date('2011-09-01T22:00:00',Zend_date::DATETIME));
But i get the error:
PHP Fatal error: Call to undefined method Zend_Date::format() in /var/www/shared/Doctrine/lib/vendor/doctrine-dbal/lib/Doctrine/DBAL/Types/DateTimeType.php on line 44
Does anyone have experience with this and able to help me with this problem?
Doctrine2 expects PHP DateTime objects for DQL date and datetime types.
If you are not forced to use a Zend_Date, to this:
->setStartDateTime(new DateTime('2011-09-01T22:00:00'))
Else, convert it to a DateTime:
new DateTime('@' . $zendDate->getTimestamp())
See DateTime
docs.