Pesho Posted December 30, 2006 Share Posted December 30, 2006 Hi all,I'm now trying to implement a mysql-backed web site for online appointments for different types of services. However the available slots shown to the users should change whenever somebody books an appointment (because different types of services take different amount of time).For example the initial combo box would show:9:009:3010:0010:30...and whenever somebody books an appointment for a [b]50-min. service at 9:00[/b] the schedule should be shifted 50 mins in time as follows:9:009:50 //9:00 + 50min for the booked appointment10:20 //9:50 + 30min10:50 //10:50 + 30min...Is there any way for easy handling of time varialbles in php, I mean adding minutes to a variable...Or can you suggest a way to nicely implement this time shift after somebody books an appointment?Thanks in advance,Pesho Link to comment https://forums.phpfreaks.com/topic/32268-php-time-handling-problems/ Share on other sites More sharing options...
michaellunsford Posted December 30, 2006 Share Posted December 30, 2006 mysql has a field type "datetime" records GNU date syntax -- which looks something like "1998-12-31 23:59:59" you should be able to convert this to php time with strtotime. http://www.php.net/strtotimeThat will give you the standard time format, which you'll probably want to convert back to something useful, using date() http://www.php.net/dateIn your appointments table, you'll probably want the datetime and the procedure (or total time needed). I'd use a procedure table -- that way if some new technique can turn a one hour procedure into 45 minutes, you can just change it in the procedure table and it gets changed database wide. Link to comment https://forums.phpfreaks.com/topic/32268-php-time-handling-problems/#findComment-149920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.