-   Programming (
-   -   doctrine / postgres - timestamp without timezone (

eantoranz 05-07-2012 05:23 PM

doctrine / postgres - timestamp without timezone

I'm working on what I think is still a small project with some entities. I want to work with timestamp fields defined without timezones.

Now, doctrine complains apparently because for doctrine datetime fields won't include the milliseconds (and that's not the case).

By looking around, I see that the "parser" of datetime fields can be changed with something like this:

Doctrine\DBAL\Types\Type::overrideType('datetime', 'Doctrine\DBAL\Types\VarDateTimeType');

Now I don't get an exception but 0s in all those fields, and that's not OK either.

What is the right approach here? Who has faced this before?

eantoranz 05-07-2012 05:32 PM

Oh.... I think the problem could be somewhere else (didn't see the warnings on PHP because it's a long output). Hold your breath for a while.

eantoranz 05-07-2012 05:43 PM

Nevermind.... it was my mistake. VarDateTimeType will create PHP Datetime objects for the values. I assumed I could thow them into date('U', aDate) to get the time since UNIX epoch.... I could just ask for aDate->getTimetsmp() instead.

Thanks anyway.

All times are GMT -5. The time now is 10:13 AM.