zeckdude zeckdude - 3 years ago 223
PHP Question

How do I add 24 hours to a unix timestamp in php?

I would like to add 24 hours to the timestamp for now. How do I find the unix timestamp number for 24 hours so I can add it to the timestamp for right now?

I also would like to know how to add 48 hours or multiple days to the current timestamp.

How can I go best about doing this?

Answer Source

You probably want to add one day rather than 24 hours. Not all days have 24 hours due to daylight saving time:

strtotime('+1 day', $timestamp);

Try this :

$inputedDate = "2016-10-12 8:50:00";
$incrementedDate = date ("Y-m-d H:i:s",strtotime($inputedDate)+86400);
echo $incrementedDate;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download