Home >Backend Development >PHP Problem >How to get today's date in php

How to get today's date in php

藏色散人
藏色散人Original
2021-11-26 09:25:022577browse

php method to get what day it is today: 1. Create a PHP sample file; 2. Get what day it is through the "echo date('d')" method.

How to get today's date in php

#The operating environment of this article: Windows7 system, PHP7.1, Dell G3.

How to get what day is today in php?

php gets the day of the day and the day of the week

The code is as follows:

echo date(&#39;y&#39;).&#39;</br>&#39;;    //当前年份
echo date(&#39;m&#39;).&#39;</br>&#39;;    //当前月份
echo date(&#39;d&#39;).&#39;</br>&#39;;    //当前日
echo date(&#39;s&#39;).&#39;</br>&#39;;    //当前秒
echo date(&#39;w&#39;).&#39;</br>&#39;;    //当前周几

Print as follows

How to get todays date in php

Recommended learning: "PHP video tutorial"

The above is the detailed content of How to get today's date in php. For more information, please follow other related articles on the PHP Chinese website!

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