If you want to subtract seconds from datetime in php. I am explaining you simply step by step how to subtract seconds from current time with PHP. you can understand a concept of how to subtract seconds from time in php. let’s see example about how to subtract seconds from time in php.
Here, I created a basic example of subtract 30 seconds from provided time in php.
<?php
$time = "05:10:40";
$newTime = date('H:i:s', strtotime($time. ' -30 seconds'));
echo "Before Time : ".$time;
echo "<br/>";
echo "Updated Time : ".$newTime;
?>
Result:
Before Time : 05:10:40
Updated Time : 05:10:10
Hello, Welcome to webdeveloperindia.in. I am a full-stack web developer. Email – [email protected] | Skype – azaruddin23. I have knowledge of PHP, Laravel, Magento 1/2, Codeigniter, WordPress, Joomla, Shopify, Git, Bitbuket, jQuery, Ajax, Javascript and ReactJS.
Thank you so much