Symfony2 datetime best way to store timestamps?

后端 未结 4 707
醉话见心
醉话见心 2020-12-15 08:55

I don\'t know which is the best way to store a timestamp in the database. I want to store the entire date with hours minutes and seconds but it only stores the date ( for in

4条回答
  •  無奈伤痛
    2020-12-15 09:24

    You can use @Version like this:

    /**
     * @var date $created
     *
     * @ORM\Column(name="created", type="datetime")
     * @ORM\Version
     */
    private $created;
    

    This will only work on a datetime type.

提交回复
热议问题