Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4237172
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:44:18+00:00 2026-05-21T02:44:18+00:00

I see there is strange problem in php with month addition and subtraction. My

  • 0

I see there is strange problem in php with month addition and subtraction.

My questions are:

  • does 1 month have an equivalent in days ?
  • if yes, is this a common standard in all programing languages ?

    A few examples:

    echo date('Y-m-d',strtotime('2011-03-31 -1 months')); //2011-03-03
    echo date('Y-m-d',strtotime('2011-03-30 -1 months')); //2011-03-02
    echo date('Y-m-d',strtotime('2011-03-29 -1 months')); //2011-03-01
    echo date('Y-m-d',strtotime('2011-03-28 -1 months')); //2011-02-28
    
    • 1 1 Answer
    • 0 Views
    • 0 Followers
    • 0
    Share
    • Facebook
    • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    • Random
    1. Editorial Team
      Editorial Team
      2026-05-21T02:44:19+00:00Added an answer on May 21, 2026 at 2:44 am

      From your examples, it looks like it’s subtracting 1 from the month part, and then correcting for illegal dates. Your second example:

      2011-03-30 - 1 month = 2011-02-30. This date does not exist, as February 2011 had only 28 days. 30 - 28 = 2, so it puts it as the 2nd day of the following month.

      However, I have not found documentation about this.

      Either way, assuming I’m right, the answer to your question is no, “1 month” does not have a (constant) equivalent in days, it depends on the input.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    I have a strange problem where a for loop in PHP only returns the
    Ok so this one is strange and I'm thinking there must be a problem
    I am faced with this strange problem: In an .net web application, there is
    Shouldn't this be a pretty straightforward operation? However, I see there's neither a size()
    Edit: There is a somewhat strange solution to this question. Check my answer posted
    I have a strange problem when I try to deploy my current app to
    I have a strange problem creating new counters in existing group. I have a
    I see there are a few . Which ones are maintained and easy to
    What is the best method for user authorisation/authentication in ASP.NET MVC? I see there
    I see that there is Controller.RedirectToAction(string actionName, string controllerName, object values) but I never

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.