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
You can also use date_modify()
function of DateTime class to achieve the same thing :
This will output something like:
2021-01-26 08:48:04