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 6870189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:39:10+00:00 2026-05-27T03:39:10+00:00

$date = date(‘Y-m-d’,current_time(‘timestamp’, 0)); How do I change $date to $date + 5 days

  • 0
$date = date('Y-m-d',current_time('timestamp', 0));

How do I change $date to $date + 5 days?

PHP version is 5.2.

This code doesn’t work:

$date_cur = date('Y-m-d',current_time('timestamp', 0));
echo $date_cur . ' <br>';
$date_cur_plus = date($date_cur, strtotime('+5 days'));
echo $date_cur_plus;

Gives me:

2011-11-29 
2011-11-29
  • 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-27T03:39:11+00:00Added an answer on May 27, 2026 at 3:39 am

    You could use mktime() using the timestamp.

    Something like:

    $date = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') + 5, date('Y')));
    

    Using strtotime() is faster, but my method still works and is flexible in the event that you need to make lots of modifications. Plus, strtotime() can’t handle ambiguous dates.

    Edit

    If you have to add 5 days to an already existing date string in the format YYYY-MM-DD, then you could split it into an array and use those parts with mktime().

    $parts = explode('-', $date);
    $datePlusFive = date(
        'Y-m-d', 
        mktime(0, 0, 0, $parts[1], $parts[2] + 5, $parts[0])
        //              ^ Month    ^ Day + 5      ^ Year
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

echo date(W,strtotime('2010-01-01')); This outputs 53. I would expect it to output 1. Can anyone
date = re.search(r'([\x\d\w-.\s,()&\]+|) I am migrating a code from PHP to Python, and am
date('H-m-s') gives something like this when I echo variable > 08-07-16 I have table
Date and time in MySQL can be stored as DATETIME, TIMESTAMP, and INTEGER (number
new Date(05-MAY-09 03.55.50) is any thing wrong with this ? i am getting illegalArgumentException
echo date(w,strtotime(date(Y-m-d))); echo date(w,strtotime(date(Y年m月d日))); Save it as utf8.You'll see the second is bigger than
Date ranges including BC dates is this possible? I would like to return facets
var date = 2012-01-18T16:03; var date = new Date(date); console.log(date.getMinutes()); console.log(date.getMinutes().length) This returns 3.
Date(F d Y H:i:s) gives current time in php. How can I get delay
the date is like this :12/07/2009 7:30:45 PM now i need to format the

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.