Monday, August 6, 2012

Adding Time

Today I thought I would add a quick note about how to utilize the strtotime() function in PHP to add time and still keep it in the desired format. The trick is to pass the strtotime() function to the date() function in order to keep the formatting.

$end_time = date('H:i:s', strtotime($start_time)+5);
// 5 represents time to be added in seconds. 

No comments:

Post a Comment