PHP common library functions, php library functions
1. Time and date
- How to get the timestamp time()--the number of milliseconds since 1970
echo time();
Copy after login
echo date(<span>'</span><span>Y-m-d H:i:s</span><span>'</span>);
Copy after login
- The default time zone is obtained
echo date_default_timezone_get();
Copy after login
- The time obtained by default is inconsistent with the local computer time, and the corresponding time zone needs to be set
date_default_timezone_set('Asia/Shanghai'); //设置为上海的时区
echo date(<span>'</span><span>Y-m-d H:i:s</span><span>'</span>);
Copy after login
- Convert timestamp to date and present it
echo date(<span>'</span><span>Y-m-d H:i:s</span><span>'</span><span>,time());
echo </span><span>'</span><span><br/></span><span>'</span><span>;
echo date(</span><span>'</span><span>Y-m-d H:i:s</span><span>'</span>,time());
Copy after login
http://www.bkjia.com/PHPjc/1070037.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1070037.htmlTechArticlePHP common library functions, php library functions 1. How to get the timestamp time()--from 1970 The number of milliseconds calculated from the beginning of the year echo time(); Date echo date( ' Y-m-d H:i:s ' ); The default value is...