PHP get current timestamp

1. The time() function returns the number of seconds of the current time since the Unix epoch (January 1 1970 00:00:00 GMT).

echo time(); //output 1531201452.

2. The date('format',time()) function is used to format the time/date. The time() parameter can be omitted.

echo date('Y-m-d h:i:s', time());   // 2016-12-31 05:07:05 h为12小时制

echo date('Y-m-d H:i:s');   // 2016-12-31 13:07:05 H为24小时制

Guess you like

Origin blog.csdn.net/an17822307871/article/details/113875247