How to add one hour in php date?

I have a date variable in PHP and I want to add one hour to it. What is the code for adding one hour to the PHP date?

Thanks

View Answers

February 14, 2015 at 4:18 PM

Hi,

You should convert the date into time and then add convert the 60 minute (one hour) into time.

Then add the both to get and convert it to date. This way you can achieve the result.

$currentTime = time($todayDate);

//Add one hour equavelent seconds 60*60

$timeAfterOneHour = $currentTime+60*60;

Check the tutorial Adding one hour in php.

Thanks









Related Tutorials/Questions & Answers:
Advertisements