Php obtains the day of a day, the day of the week, and the date corresponding to the day of the week and the day of the week.

Source: Internet
Author: User

Php obtains the day of a day, the day of the week, and the date corresponding to the day of the week and the day of the week.

$ Today = date ("Y-m-d ");

Echo $ today; // you can get the number of today. Output

// Define an array first.

$ Rows = array ("day", "one", "two", "three", "four", "five", "Six ");
Echo "Today is the week". $ rows [date ("w")]."
";

// Note date ("w"). You can obtain the number of weeks, for example, 123. Note that 0 is Sunday. The subscript of the array starts from 0.

// Quickly obtain the corresponding date of the week

Echo "this Monday is". date ('Y-m-d', strtotime ("this Monday "))."
"; // Output. Because today is just Monday, the result is special. If you are interested, open it tomorrow to see if the result is correct.

// Quickly obtain the date corresponding to the next Monday

Echo "this Monday is". date ('Y-m-d', strtotime ("next Monday "))."
"; // Output

?>

PS: The strtotime () function parses the datetime description of any English text into a Unix timestamp.

Attach the corresponding weekly English: Monday ['m? Ndi,'m? Ndei]

Tuesday ['tju: zdi]
Wednesday on Wednesday ['wenzdei, 'wenzdi]

Thursday on Thursday ['θ? : Zdi]

Friday ['fraidi]
Saturday ['s? T? Di]

Sunday ['s? Ndi]

Related Article

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.