fix date format on oracle #557

wants to merge 1 commit into


None yet

3 participants


The expected format for DATE columns is 01-MAR-14. See

It also works with 01-Mar-2014 as this PR uses.

We found the problem when trying something like

    'SELECT * FROM table WHERE datefield > ?',
    array(new \DateTime()),

which was raising an oracle error that the date could not be parsed.

The time format in getTimeFormatString is also wrong because according to the above doc, times can only be passed by using TO_DATE('13-AUG-66 12:56 A.M.','DD-MON-YY HH:MI A.M.').
So this requires wrapping the SQL with a TO_DATE function.



thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

We use Jira to track the state of pull requests and the versions they got
included in.

@Tobion Tobion referenced this pull request Mar 28, 2014

fix date format on oracle #556

Doctrine member

You have to use OracleSessionInit to get the date formats right. See the documentation.
I cannot remember anymore why this is necessary but there definitely is a reason for this. I think it's because Doctrine requires some convenient format for date type columns. However this is the way users are handling this kind of problem and we won't be able to change this behaviour anyways in 2.x as it would break users' applications badly. So please bare with me closing this issue. Use the OracleSessionInit listener and it will fix your issue. If you have further question I will help you :)

@deeky666 deeky666 closed this Mar 28, 2014

Thanks for the answer. Is it gonna be fixed in 3.0? Imho it should work out-of-the-box and not require some listeners to be activated manually.

@Tobion Tobion deleted the Tobion:patch-3 branch Nov 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment