In my Mysql table I have a timestamp field. In my php page I show the record ($row[data]) in this way
echo date("d-m-Y H:i:s", strtotime($row['data']));
Now in my php I'd like to add 1 hour on my date. How can I do this? Thanks
echo date("d-m-Y H:i:s", strtotime($row['data'])+3600);
note that you can't compare resulting dates in "d-m-Y" format.
either compare strtotime
results or initial dates. or format your results into proper format first.
You could do this straight away in MySQL:
SELECT `date` + INTERVAL 1 HOUR AS `date`
FROM ...
echo date("d-m-Y H:i:s", strtotime($row['data'].' +1 hour'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With