How can I add 30 seconds to this time?
$time = date(\"m/d/Y h:i:s a\", time());
I wasn\'t sure how to do it because it is showing lots of diffe
If you're using php 5.3+, check out the DateTime::add operations or modify
, really much easier than this.
For example:
$startTime = new DateTime("09:00:00");
$endTime = new DateTime("19:00:00");
while($startTime < $endTime) {
$startTime->modify('+30 minutes'); // can be seconds, hours.. etc
echo $startTime->format('H:i:s')."
";
break;
}