PHP Zend date format

后端 未结 6 1623
粉色の甜心
粉色の甜心 2021-02-19 08:12

I want to input a timestamp in below format to the database.

yyyy-mm-dd hh:mm:ss

How can I get in above format?

When I

6条回答
  •  萌比男神i
    2021-02-19 08:19

    I've always use $date->__toString('YYYY-MM-dd HH-mm-ss'); method in the past but today didn't work. I was getting the default output of 'Nov 1, 2013 12:19:23 PM'

    So today I used $date->get('YYYY-MM-dd HH-mm-ss'); as mentioned above. Seems to have solved my problem.

    You can find more information on this on output formats here: http://framework.zend.com/manual/1.12/en/zend.date.constants.html

提交回复
热议问题