Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does php get the day of the week when the specified date is?

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "php how to get the specified date is the day of the week". The explanation in the article is simple and clear and easy to learn and understand. please follow the editor's train of thought to study and learn "php how to get the specified date is the day of the week"!

Acquisition method: 1, define "array (" 7 "," 1 "," 2 "," 3 "," 4 "," 5 "," 6 ") array; 2, use" date ("w", strtotime ("specified date") ") to convert the date into a number of days of the week; 3, take the number as the subscript and take the corresponding day value in the array.

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Php gets the day of the week on which the specified date is

Determine the day of the week on which the specified date is, that is, what day of the week it is.

We can do this using date ("w", strtotime ("specified date"); but the return value of this statement is: a number indicating the day of the week (0 for Sunday [Sunday], 6 for Saturday [Saturday]).

We can create an array like this:

Array ("seven", "one", "two", "three", "four", "five", "six")

Take the return value of the above date () statement as the subscript and fetch the corresponding day value of the week in the array.

Let's look at the implementation code:

Thank you for your reading, the above is the content of "how to get the specified date is the day of the week". After the study of this article, I believe you have a deeper understanding of how php gets the day of the week, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report