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.

How to save the date in oracle?

I need to keep the date oracle and I think the developer tools, saved the date in mm-dd-yyy. While Oracle saved the date in dd / mm / yyyy as change the date format of the input element. How to save the date in oracle?

You can define a beforeSave function in your model to format the date as you need.


Something like this or what would be the best way to validate the format

public function beforeSave()
    // Set the modification date
    $this->modified_in = date('Y-m-d H:i:s');

Yes that's the way to validate data and more with validators :


public function afterFetch() { $this->start = new DateTime($this->start); }

  public function beforeSave()
      $this->start = $this->start->format("Y-m-d H:i:s");
edited Feb '16

That should work, or you can use Phalcon\Mvc\Model\Behavior\Timestampable :

public function initialize()
    $this->addBehavior(new Timestampable([
        'beforeSave'  => [
            'field'     => 'start',
            'format'    => 'Y-m-d H:i:s'


Use new \Phalcon\Db\RawValue('SYSDATE');