PHP gets a few days of the week and this week of Monday and next Monday corresponds to the date _php tutorial

Source: Internet
Author: User

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


$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, 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]

http://www.bkjia.com/PHPjc/890206.html www.bkjia.com true http://www.bkjia.com/PHPjc/890206.html techarticle PHP Gets the dates of the days of the week and Monday and next Monday for this week $today =date ("y-m-d"); echo $today;//To get today's date. Output 2014-9-29//define a number first ...

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