search

Home  >  Q&A  >  body text

php - How to format Beijing time into 2012-08-24T14:02:15-04:00

Currently we only know that DATE_ATOM formatted into UTC is 2012-08-24T14:02:15 00:00. How can the latter offset be generated through a function? ? ? ?

代言代言2798 days ago1057

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-06-29 10:10:52

    The last -04:00 is the offset between the current time zone and the UTC standard time zone.

    If you set the time zone (such as Beijing), then the offset (+08:00) East Eighth District

    date("P"); // 显示时区偏移量

    Your -04:00 indicates that the time zone set is -04:00 (West 4th District)

    reply
    0
  • 三叔

    三叔2017-06-29 10:10:52

    Excerpted from PHP documentation:
    http://php.net/manual/en/func...

    You can use date('O') or date('P'), depending on what format you need.

    reply
    0
  • Cancelreply