In this article, we will learn how to add seconds to the current time in PHP its very useful when working on a date and time functionality


Example

let's add 30 seconds to the current time. if you want to another value you can replace 3o to other s.


index.php

<?php
// adding 30 seconds
$date = date('Y-m-d H:i:s', (time() + 30));
echo $date;
?>


Output:

2021-01-27 11:28:17