search

Home  >  Q&A  >  body text

Timestamp - php using strtotime to convert time to 6 more hours

The time obtained using the time function is normal

高洛峰高洛峰2866 days ago678

reply all(3)I'll reply

  • 某草草

    某草草2017-05-16 13:04:59

    Check time zone

    echo date('Y-m-d H:i',0);

    If it is Beijing time, then this will output 1970-01-01 08:00

    If it’s really wrong and you need to set it up, you can use this

    date_default_timezone_set('America/Los_Angeles');//设置为LAX
    //中国是PRC

    reply
    0
  • 黄舟

    黄舟2017-05-16 13:04:59

    Reference About the time zone issue of PHP functions time() date() and strtotime()

    It is recommended to post the code

    reply
    0
  • 为情所困

    为情所困2017-05-16 13:04:59

    It’s a time zone problem. Set the time zone to date_default_timezone_set("PRC") or set
    'timeZone'=>'Asia/shanghai' in Yii config->main.php to solve the problem

    reply
    0
  • Cancelreply