In the following example code we are showing how you can add one hour to a date object.
<?php //This PHP Example code shows how to add one hour to a date object
$todayDate = date("Y-m-d g:i a");// current date
$currentTime = time($todayDate); //Change date into time
//echo "<br>".$currentTime;
//Add one hour equavelent seconds 60*60
$timeAfterOneHour = $currentTime+60*60;
/echo "<br>".$timeAfterOneHour;
echo "<br>Current Date and Time: ".date("Y-m-d H:i:s",$currentTime);
echo "<br>Date and Time After adding one hour: ".date("Y-m-d H:i:s",$timeAfterOneHour);
?>
Output of the program:
Current Date and Time: 2009-08-27 10:55:48
Date and Time After adding one hour: 2009-08-27 11:55:48
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.