Symony2, doctrine of datetime in microseconds

In symfony2, I created an object with created and updated parameters:

/**
     * @var \DateTime $created
     *
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     * @Serializer\Expose
     */
    protected $created;

    /**
     * @var \DateTime $updated
     *
     * @Gedmo\Timestampable(on="update")
     * @ORM\Column(type="datetime")
     */
    protected $updated;

      

When I update the schema below, the requests are made:

ALTER TABLE review ADD created TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL;
ALTER TABLE review ADD updated TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL;

      

How can I store datetime with microseconds in postgreSql database?

+3


source to share


1 answer


You cannot do this by specifying PHP parameters like DateTime ( \DateTime

).

Because PHP DateTime doesn't support fractional seconds. This is reported in the first comment on the PHP DateTime page . I was surprised myself.



I know this won't solve your problem, but I've just spent a few hours trying to figure out what's going on with my microseconds.

0


source







All Articles