search

Home  >  Q&A  >  body text

thinkphp time problem

The database has a field called the askTime field. Every time data is inserted, the current time will be stored. The format is year, month, day, hour, minute and second. But the problem is I don’t know how to take it out as it is?
Try one: var_dump($date['askTime']) output is null
Try two: echo date("Y-m-d H:i:s",$date['askTime']) output 1970-01- 01 08:00:00, but the time zone has been set in the config file
How does tp3.2 output the formatted date in the database as it is? ?

黄舟黄舟2768 days ago695

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-27 17:44:48

    What you save is the formatted time, then you can retrieve it as a string. Unless you converted it when saving, it is best to take a screenshot to see the data in the database field

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-27 17:44:48

    1. Screenshot database askTime content

    2. If askTime is a string and not a timestamp, don’t use date

    reply
    0
  • Cancelreply