suresh64633 Posted September 11, 2009 Share Posted September 11, 2009 How do i add 30 minutes to my time in PHP Time are like 10:00 AM, 12.30 AM,02:00 PM. Quote Link to comment Share on other sites More sharing options...
syed Posted September 11, 2009 Share Posted September 11, 2009 Convert your time to a timestamp, then add 1800 seconds to the timestamp then convert it back to a formatted time. Quote Link to comment Share on other sites More sharing options...
suresh64633 Posted September 11, 2009 Author Share Posted September 11, 2009 Got the Answer: $startTime = 07:00 AM for($loop=1;$loop<=5;$loop++) { $event_length = 30*$loop; $timestamp = strtotime("$startTime"); $etime = strtotime("+$event_length minutes", $timestamp); echo $next_time = date('h:i A', $etime)."<br />"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.