How to get Unix timestamp in php based on timezone

后端 未结 5 583
温柔的废话
温柔的废话 2020-11-30 07:54

Code first

    echo time() . \'
\'; echo date(\'Y-m-d H:i:s\') . \'
\'; date_default_timezone_set(\'America/New_York\'); echo time() .
5条回答
  •  没有蜡笔的小新
    2020-11-30 08:09

    https://en.wikipedia.org/wiki/Unix_time

    Unix time, or POSIX time, is a system for describing instants in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of Thursday, January 1, 1970

    The unix timestamp isn't affected by a timezone setting. Setting the timezone only affects the interpretation of the timestamp value.

提交回复
热议问题