Add hours/minutes to Timestamp in PHP

0
54

You can add hours, minutes or days to any given date or current timestamp in PHP.

Example:

$old_date =”2019-03-18 19:19:00″;

$new_date=date(‘Y-m-d H:i:s’, strtotime($old_date)+28800);

This code will add 8 hours to given date.

You can use the same function to decrease the time by using (-) in above example.

LEAVE A REPLY

Please enter your comment!
Please enter your name here