Add 30 seconds to the time with PHP

You can use the strtotime function in PHP to add a specified number of seconds to a given time. Here is an example of how to add 30 seconds to the current time:

This will output something like:

Original time: 2021-01-26 08:47:34
New time: 2021-01-26 08:48:04

Watch a course Learn object oriented PHP

You can also use date_modify() function of DateTime class to achieve the same thing :

modify('+30 seconds');
echo $date->format('Y-m-d H:i:s');

This will output something like:

2021-01-26 08:48:04