Hi. I am sending to save a date in my database,
02/08/2016 07:13:47
but I have the following error
SQLSTATE[HY000]: General error: 1843 OCIStmtExecute: ORA-01843: not a valid month (/tmp/pear/download/PDO_OCI-1.0/oci_statement.c:142)
IF I run the statement directly to the database, it is stored correctly but I check the model and find that this type column string
/**
*
* @var string
*/
public $DETA_FECHA;
How to specify a column type datetime?. Here is my model
<?php
use Phalcon\Mvc\Model\Behavior\Timestampable;
class SPTDETALLE extends \Phalcon\Mvc\Model{
/**
*
* @var string
*/
public $DETA_CODIGO;
/**
*
* @var string
*/
public $DETA_CANTID;
/**
*
* @var string
*/
public $DETA_FECHA;
/**
* Initialize method for model.
*/
public function initialize() {
$this->setSchema("SPOLS");
$this->addBehavior(new Timestampable([
'beforeSave' => [
'field' => 'DETA_FECHA',
'format' => 'd/m/Y H:i:s' ]
]));
}
public function getSource() {
return 'SPT_DETALLE';
}
public static function find($parameters = null) {
return parent::find($parameters);
}
public static function findFirst($parameters = null) {
return parent::findFirst($parameters);
}
}