Home  >  Article  >  Backend Development  >  PHP common library functions, php library functions_PHP tutorial

PHP common library functions, php library functions_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:05:12749browse

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();
  • Date
echo date(<span>'</span><span>Y-m-d H:i:s</span><span>'</span>);
  • The default time zone is obtained
echo date_default_timezone_get();
  • 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>);
  • 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());

www.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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn