The following function gives the next date of the date entered.
For date format: 2014-02-15
function nextDate($date)
{
$dateArray=explode('-',$date);
$tomorrow = mktime(0,0,0,$dateArray[1],$dateArray[2]+1,$dateArray[0]);
return date("Y-m-d", $tomorrow);
}
Usage of the function is as follows:
$date = "2014-06-01";
echo nextDate($date);
Ouput is: 2014-06-02
For date format: 2014/02/15
function nextDate($date)
{
$dateArray=explode('/',$date);
$tomorrow = mktime(0,0,0,$dateArray[1],$dateArray[2]+1,$dateArray[0]);
return date("Y-m-d", $tomorrow);
}
Usage of the function is as follows:
$date = "2014/06/01";
echo nextDate($date);
Ouput is: 2014/06/02
For date format: 2014-02-15
function nextDate($date)
{
$dateArray=explode('-',$date);
$tomorrow = mktime(0,0,0,$dateArray[1],$dateArray[2]+1,$dateArray[0]);
return date("Y-m-d", $tomorrow);
}
Usage of the function is as follows:
$date = "2014-06-01";
echo nextDate($date);
Ouput is: 2014-06-02
For date format: 2014/02/15
function nextDate($date)
{
$dateArray=explode('/',$date);
$tomorrow = mktime(0,0,0,$dateArray[1],$dateArray[2]+1,$dateArray[0]);
return date("Y-m-d", $tomorrow);
}
Usage of the function is as follows:
$date = "2014/06/01";
echo nextDate($date);
Ouput is: 2014/06/02
No comments:
Post a Comment