PHP get the day of the week in detail _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP gets a detailed explanation of the day of the week. PHP day of the week to get the code: date (l); data can get the week of the English language, such as Sundaydate (w); this can get the number of weeks such as 123, note that 0 is the day of the Chinese day of the week. The PHP day of the week is obtained on Sunday:
Date ("l"); // data can be used to obtain the week in English, such as Sunday.
Date ("w"); // you can obtain the number of weeks, for example, 123. Note that 0 is Sunday.

Get Chinese day of the week:
$ Weekarray = array ("day", "one", "two", "three", "four", "five", "six"); // define an array first
Echo "week". $ weekarray [date ("w")];

Obtain the specified date:
$ Weekarray = array ("day", "one", "two", "three", "four", "five", "six ");
Echo "week". $ weekarray [date ("w", "2011-11-11")];

Because the date function is very powerful, he is fully qualified for all such work. I have attached a table in the manual for convenient reference at any time.
1. a-"am" or "pm"
2. A-"AM" or "PM"
3. d-a few days, two digits. if there are less than two digits, fill in the first zero. for example: "01" to "31"
4. D-the day of the week, with three English letters, for example, "Fri"
5. F-month, full English name; for example: "January"
6. h-12 hours; for example, "01" to "12"
7. H-24 hours; for example: "00" to "23"
8. hours in the g-12 hour format, less than two do not fill in zero; for example: "1" to 12"
9. hours in the G-24 hour system, less than two do not fill in zero; for example: "0" to "23"
10. I-minutes; for example: "00" to "59"
11. j-a few days, two digits. if less than two digits are left blank, for example, "1" to "31"
12. l-the day of the week. Full name in English; for example, "Friday"
13. m-month, two digits. if there are less than two digits, add zero in front, for example, "01" to "12"
14. n-month, two digits. if less than two digits are left blank, for example, "1" to "12"
15. M-month, with three English letters, for example, "Jan"
16. s-second; for example: "00" to "59"
17. S-ending with an English sequence, two English letters, for example, "th", "nd"
18. t-specifies the number of days in a month, for example, "28" to "31"
19. U-total seconds
20. w-number of weeks, for example, "0" (Sunday) to "6" (Saturday)
21. Y-year, four digits, for example, "1999"
22. y-year, two digits, for example, "99"
23. z-the day of the year; for example, "0" to "365"

Week date ("l"); // data can be used to obtain the week in English, for example, Sunday date ("w"); // you can obtain the week number, for example, 123, note that 0 is the day of the Chinese Week obtained on Sunday...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.