Time function in PHP

timestamp

    • The number of seconds from January 1, 1970 0:0:00 seconds to the specified time, timestamp is of integer data type.
    • PHP timestamps are the maximum representation from 1970 to around January 27, 2038

set time zone

    • The default time of the server is the national unified time, Greenwich, so you need to set the time zone of the current server before using the server.
    • php.ini configuration file date.timezone=Asia/Shanghai or date.timezone=ETC/GMT-8 (PRC)
    • Set date_default_timezone_set('PRC') directly with the function

related functions

time() can get the current timestamp

date() formats a timestamp

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325187417&siteId=291194637