Jump to content

php time handling problems...


Pesho

Recommended Posts

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:00
9:30
10:00
10: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:00
9:50    //9:00 + 50min for the booked appointment
10:20  //9:50 + 30min
10: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

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/strtotime

That will give you the standard time format, which you'll probably want to convert back to something useful, using date() http://www.php.net/date

In 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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.