Home  >  Article  >  Backend Development  >  How to calculate the day of the week in php

How to calculate the day of the week in php

coldplay.xixi
coldplay.xixiOriginal
2020-08-27 11:15:532972browse

php method to calculate what day of the week the current date is: first open the php editor and create a new php file; then enter the code [$day = '2020-08-26';$week = date('l', $day)]; Finally, the browser can run the [index.php] page.

How to calculate the day of the week in php

Related learning recommendations: php graphic tutorial

php method to calculate the day of the week the current date is:

1. First, open the php editor and create a new php file, for example: index.php.

How to calculate the day of the week in php

2. In index.php, enter the code:

$day = '2020-08-26';$week = date('l', $day);echo $week;

How to calculate the day of the week in php

3. Run index.php in the browser page, and the day of the week for the specified date will be printed.

How to calculate the day of the week in php

If you want to know more about related learning, please pay attention to the php training column!

The above is the detailed content of How to calculate the day of the week 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