Solved

date + 1 day`

Posted on 2013-05-12
6
580 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
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 34

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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
LVL 109

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

810 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