date + 1 day`

date written in this format
year month day
2013-05-13

want date + 1 day
2013-05-14
LVL 1
rgb192Asked:
Who is Participating?
 
Sandeep KothariConnect With a Mentor Project LeadCommented:
you need to use mktime function

http://php.net/manual/en/function.mktime.php
0
 
GaryConnect With a Mentor Commented:
<?php
$date="2013-05-14";
echo date('Y-m-d', strtotime('+1 day', strtotime($date)));
?>

Open in new window

0
 
gr8gonzoConnect With a Mentor ConsultantCommented:
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
GaryConnect With a Mentor Commented:
That will not work for daylight savings
0
 
Ray PaseurConnect With a Mentor Commented:
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
 
rgb192Author Commented:
thanks all and double thanks to Gary about daylight savings
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.