php convert datetime to UTC

后端 未结 16 1063
無奈伤痛
無奈伤痛 2020-11-27 12:30

I am in need of an easy way to convert a date time stamp to UTC (from whatever timezone the server is in) HOPEFULLY without using any libraries.

16条回答
  •  再見小時候
    2020-11-27 12:58

    Do this way:

    gmdate('Y-m-d H:i:s', $timestamp)
    

    or simply

    gmdate('Y-m-d H:i:s')
    

    to get "NOW" in UTC.

    Check the reference:

    http://www.php.net/manual/en/function.gmdate.php

提交回复
热议问题