In MySql database we have a column of type time and we need to increment the time by fifteen minutes in our php code.
For example time is 09:45:00, it should become 10:00:00
You can fetch it directly from mysql itself:
Select DATE_ADD('09:45:00', INTERVAL 15 MINUTE) as updatetime from tableName
For more information you can visit : http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add
As per your comment if you want to do it in PHP, You can do like this:
$date = new DateTime('09:45:00');
$date->add(new DateInterval('PT15M'));
echo $date->format('h:i:s') . "\n"; //it i will give you 10:00:00
how about doing this:
strtotime("+15 minutes" , time());
strtotime("+15 minutes" , strtotime( $this->time )); // suppose it's a string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With