gple Posted October 28, 2009 Share Posted October 28, 2009 i have a variable of time $time="13:30:00" how do i add 1 hour and 15 minutes to this. Link to comment https://forums.phpfreaks.com/topic/179285-add-time-to-a-variable/ Share on other sites More sharing options...
damdempsel Posted October 28, 2009 Share Posted October 28, 2009 Do you mean like doing this?: time()+900 That is the current time, plus 900 seconds (15 minutes). Link to comment https://forums.phpfreaks.com/topic/179285-add-time-to-a-variable/#findComment-945924 Share on other sites More sharing options...
Alex Posted October 28, 2009 Share Posted October 28, 2009 First convert $time to a UNIX timestamp using strtotime(). Then add 1 hour and 30 seconds to it, and convert it back to the format you want using date() date('H:i:s', strtotime("13:30:00") + 60*60*1.5); Link to comment https://forums.phpfreaks.com/topic/179285-add-time-to-a-variable/#findComment-945929 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.