I'm going to take a little brother, don't I find a bug in PHP? Calculate the last day of the next month related issues

Source: Internet
Author: User
I'm going to go, did I find a bug in PHP? Calculate the last day of next month's problem!
Words not much to say, directly on the code:

$BeginDate = "2015-05-31";
New gets the last 1 days of the specified month
echo Date ("Y-m-t", Strtotime ("+1 months", Strtotime ($BeginDate)));


Based on experience, the results should be: 2015-06-30

But the actual operation result is not, everybody please try, and ask everybody this is why ~ ~ ~ knocked Me Out

Another: If the start time is set to 2015-05-30 the calculation result is correct
------to solve the idea----------------------
$BeginDate = "2015-05-31";
echo Date ("Y-m-d T", Strtotime ("+1 months $BeginDate"));
2015-07-01 on 31

What's the problem?
May 31 plus One months (June is 30 days) so that's July 1, the last day of July is 31st?
Looks like something's wrong with your experience.
  • 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.