5 ? 'Yes' : 'No' ) . 'Weekend';"; Finally execute the file."/> 5 ? 'Yes' : 'No' ) . 'Weekend';"; Finally execute the file.">

Home  >  Article  >  Backend Development  >  How to determine whether a date is a weekend in php

How to determine whether a date is a weekend in php

藏色散人
藏色散人Original
2021-06-01 09:31:393846browse

php method to determine whether a date is a weekend: first create a new php file; then enter the code "echo 'today' . date('Y-m-d') . (date('N') >5 ? 'Yes' : 'No') . 'Weekend';"; Finally, just execute the file.

How to determine whether a date is a weekend in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

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

How to determine whether a date is a weekend in php

In index.php, enter the code: echo 'today' . date('Y-m-d') . (date('N') >5? 'is' : 'is not') . 'weekend';.

How to determine whether a date is a weekend in php

The browser runs the index.php page, and the result of determining whether today is a weekend will be printed out.

How to determine whether a date is a weekend in php

Recommended study: "PHP Video Tutorial"

The above is the detailed content of How to determine whether a date is a weekend 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