Re: Calculating time unused
| From: | David Robley | Date: | Wed, 01 Oct 2003 02:46:21 +0000 |
| Subject: | Re: Calculating time unused | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30785@lists.php.net to get a copy of this message | ||
In article <20030930103246.49107.qmail@pb1.pair.com>, shaun@mania.plus.com
says...
> Hi,
>
> I have a table called Bookings which has two important columns;
> Booking_Start_Time and Booking_End_Time. These columns are both of type
> DATETIME. Given any day how can I calculate how many hours are available
> between the hours of 09.00 and 17.30 so a user can see at a glance how many
> hours they have unbooked on a particular day, can this be done with a query
> or do I have to work it out with PHP?
>
> Thanks for your help
Seems easy enough - just sum the time booked per day and subtract it from
the constant which is the total of available hours, and group by day.
You'll need to calculate the booked time based on existing start/end
values but you should be able to do that in SQL.
Cheers
--
Quod subigo farinam
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?