Home  >  Article  >  Backend Development  >  PHP gets the current date and formats it, php gets the current date_PHP tutorial

PHP gets the current date and formats it, php gets the current date_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:20:22827browse

PHP gets the current date and formats it, php gets the current date

date('Y-m-d H:i:s',time());

How does PHP get the current time

To set the time zone, PHP's default time zone is not China's time zone, but Greenwich Mean Time. So just set the time zone and you’re done! eb7d796cb198a9ebe90c4bbf04803752

How to get the timestamp (year-month-day) of the current date in PHP?

Just use the date function to format it!
echo date("Y-m-d",time());
See the picture for format string description~
I hope my answer will be helpful to you! Haha~


PHP gets the current date and formats it, php gets the current date_PHP tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/867007.htmlTechArticlePHP gets the current date and formatting, php gets the current date date('Y-m-d H:i:s',time ()); How to get the current time in PHP requires setting the time zone. The default PHP time zone is not China’s time zone, but Greenwich Mean Time...
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