php – Add a time to current time

Question:

I am trying to record the current system time.

For example the current date is going to be 01-08-2019 10:34:44 and I wanted that same date, but add one more hour, so it would be 01-08-2019 11:34:44 .

$data_pagamento = date('Y-m-d H:i:s');

Answer:

You can use the DateTime and add the 1 hour with modify .

$date = new DateTime();
$date->modify('+1 hour');
Scroll to Top