Solved

date + 1 day`

Posted on 2013-05-12
6
584 Views
Last Modified: 2013-05-13
date written in this format
year month day
2013-05-13

want date + 1 day
2013-05-14
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 200 total points
ID: 39160092
<?php
$date="2013-05-14";
echo date('Y-m-d', strtotime('+1 day', strtotime($date)));
?>

Open in new window

0
 
LVL 35

Assisted Solution

by:gr8gonzo
gr8gonzo earned 100 total points
ID: 39160119
You can eliminate the second strtotime() call by just adding 86,400 seconds (the total # of seconds in a day):

$tomorrow = date("Y-m-d",strtotime("2013-05-13")+86400);
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 200 total points
ID: 39160121
That will not work for daylight savings
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 100 total points
ID: 39160148
One more time... It's all in this article that I keep encouraging you to read!

See http://www.laprbass.com/RAY_temp_rgb192.php

<?php // RAY_temp_rgb192.php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('log_errors',     TRUE);


$date = '2013-05-13';
$plus = date('Y-m-d', strtotime($date . ' + 1 DAY'));
var_dump($date, $plus);

Open in new window

Best regards (and please read that article!!), ~Ray
0
 
LVL 7

Accepted Solution

by:
kshna earned 100 total points
ID: 39160633
you need to use mktime function

http://php.net/manual/en/function.mktime.php
0
 

Author Closing Comment

by:rgb192
ID: 39162433
thanks all and double thanks to Gary about daylight savings
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP Curl Problem 10 73
Do not understand error message 3 46
how can I insert  php gmdate("Y-m-d\TH:i:s\Z") format into mysql database as date? 6 73
Format Date 7 28
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question