Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Oracle inserting dates

Hi

I've been working on an app that has to manage data on an Oracle and MySQL DB.

So far I've been able to sort most issues, but I'm a little stumped with dates... If I try to insert with a value TO_DATE(xxxx) Oracle interprets it as a String, not a Date.

How can I manage this in phalcon?

Thanks

Ronald Melo

Could you please post the code you're using to do the insertion?

edited Jan '16

I'm with the same problem. I used a TRAIT to enter the date of inclusion and registry modification. The correct way is to insert the SYSDATE for ORM put the current date. But how?

<?php
trait beforeCreate {

  public function beforeCreate() {
    $this->createIn = 'SYSDATE';
    $this->skipAttributesOnCreate(
            array('updateIn')
    );
  }

I tried using date('Ymd') but I get the ORA-01861 error.



1.3k
Accepted
answer
edited Jan '16

I could !!! Searching further in Forum saw this recommendation:

\Phalcon\Db\RawValue

My implementation:

$this->updateIn = new \Phalcon\Db\RawValue('SYSDATE');