Want to add hours in a date . Please help.
The PHP code is:
$createdDate=date_create("2013-03-17 07:11:00");
$hour = 4;
I tried using strtotime. But it gives an error.
Thanks
Want to add hours in a date . Please help.
The PHP code is:
$createdDate=date_create("2013-03-17 07:11:00");
$hour = 4;
I tried using strtotime. But it gives an error.
Thanks
You could use DateInterval
:
$iv = new DateInterval("PT{$hour}H");
$createdDate->add($iv);
// $createdDate is now modified