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

  • SEARCH
  • Home
  • 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 1072873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:55:08+00:00 2026-05-16T20:55:08+00:00

I have a date returned as part of a MySQL query in the form

  • 0

I have a date returned as part of a MySQL query in the form 2010-09-17.

I would like to set the variables $Date2 to $Date5 as follows:

$Date2 = $Date + 1

$Date3 = $Date + 2

etc., so that it returns 2010-09-18, 2010-09-19, etc.

I have tried

date('Y-m-d', strtotime($Date. ' + 1 day'))

but this gives me the date before $Date.

What is the correct way to get my Dates in the format form ‘Y-m-d’ so that they may be used in another query?

  • 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-16T20:55:09+00:00Added an answer on May 16, 2026 at 8:55 pm

    All you have to do is use days instead of day like this:

    <?php
    $Date = "2010-09-17";
    echo date('Y-m-d', strtotime($Date. ' + 1 days'));
    echo date('Y-m-d', strtotime($Date. ' + 2 days'));
    ?>
    

    And it outputs correctly:

    2010-09-18
    2010-09-19
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have date objects formatted like 2011/06/13 17:52:20 and being returned as strings. How
I have some date returned from FTP server like this Aug 28 11:03 Aug
I have an XML object being returned, and inside is a date and time
I have date formatted in this way: 2010-02-04T00:00:00 I use this code to parse
I have a date field in a query and I do want to get
I have a query that looks a bit like this (note: the actual query
I have the following JSON date returned from a MVC page e.g. DateProcessed:\/Date(1258125238090)\/ and
I have a query like this: select display_order , section_name , solution_section_id from solution_sections
I have date data being returned from a server in the following format through
I have a date formatted like this: 2011-15 The first piece is a 4

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.