The way to use date to display the day of the month in php is: "echo date('m', timestamp)."month".date('d', timestamp)."day";" ;The first parameter of the date() function is set to "m" to output the number of the month represented, and the first parameter is set to "d" to output the number representing the number of days in the month.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
php uses date to display the day of the month Date
<?php header("Content-type:text/html;charset=utf-8"); $d="1639908825"; echo "指定时间戳为: ".date('m',$d)."月".date('d',$d)."日"; ?>
Note:
PHP date() function can format the timestamp into a more readable format OK date and time.
Grammar:
date ($format [, $timestamp ] )
format Required. Specifies the format of the timestamp. When the format value is set to:
"m": the month number (01 - 12) can be output
"d": Can output a number representing the number of days in the month (01 - 31)
timestamp Optional. Specify timestamp. The default is the current date and time.
If timestamp is omitted, the month and day of the current time can be output.
<?php header("Content-type:text/html;charset=utf-8"); echo "现在是: ".date('m')."月".date('d')."日"; ?>
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to use date in php to display the day of the month. For more information, please follow other related articles on the PHP Chinese website!