I have a website based on Zend Framework. There is a form for users to fill in and the entered data is inserted in the database.
The users don't enter the date/time. I would like to populate the data value based on the current date/time . The date field is of type datetime.
i'm constantly getting the following error message:
Notice: Array to string conversion in D:\wamp\www\CNFSORG\library\Zend\Db\Statement\Pdo.php on line 228
I have tried doing the following:
<?php $date = new Zend_Date(); ?>
also tried doing:
<?php $date = new Zend_Db_Expr('NOW()'); ?>
<?php $date = new Zend_Db_Expr('CURDATE()'); ?>
I would be very grateful if someone could point me towards the right direction.
thanks in advance...
The Correct answer is
<?php $date = new Zend_Db_Expr('NOW()'); ?>
You can try create a current timestamp from php with something like that
<?php $date = new \DateTime(); ?>
Well, i'v done this for SqlServer, but i think that for MySql you just need to change the db-expression for the one you want.
$this->_colocation = new Application_Model_Colocation();
$solicitacao = $this->_colocation->find($post['hdnIdSolicitacao'])->current();
$solicitacao->data_chegada = new Zend_Db_Expr('getdate()');
$solicitacao->save();
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With