PHP gets days of the week and dates of Monday and next Monday for this week

Source: Internet
Author: User

$today =date ("y-m-d");

Echo $today; You can get the date today. Output 2014-9-29

Define an array first.

$rows =array ("Day", "one", "two", "three", "four", "five", "six");
echo "Today is the Week". $rows [Date ("W")]. "
";

Note the date ("W"), which can be obtained for the number of weeks such as 123, note that 0 is Sunday. The array subscript is starting from 0.

Get a quick date for this week

echo "This week is". Date (' y-m-d ', Strtotime ("This Monday")). "
"; Output 2014-9-29, because today is just Monday, so the results are very special, if you are interested, you can open tomorrow to try the results are correct

Quick access to the next Monday date

echo "This week is". Date (' y-m-d ', Strtotime ("Next Monday")). "
";//Output 2014-10-6

?>

The ps:strtotime () function resolves the datetime description of any English text to a Unix timestamp.

Enclosed in English for the week: Monday Monday [' M?ndi, ' m?ndei]

Tuesday Tuesday [' Tju:zdi]
Wednesday wednesday[' Wenzdei, ' Wenzdi]

Thursday thursday[' Θ?:zdi]

Friday friday[' Fraidi]
Saturday saturday[' Sæt?di]

Sunday sunday[' S?ndi]

  • 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.