Ironmonkey
|
Posted: 01/07/2002, 6:54 AM |
|
I want to create a scheduling app that groups times into shifts. Does anyone know how to do this?
|
|
|
Brent
|
Posted: 01/07/2002, 7:08 AM |
|
You need to give a bit more detail. For example. What language are you using?
PHP, ASP, JSP? Which database? What does your table structure look like and
what should the output look like?
|
|
|
Ironmonkey
|
Posted: 01/11/2002, 10:52 AM |
|
Sure,
I'm working in ASP, my database has three tables which pertain to this subject.
Basically, I have a table in the database called times, which has three values:
1. time
2. AutoID
3. ShiftID
ShiftID also exists in another table called shifts, which has the following fields.
1. ShiftID
2. Shift_Name
3. From
4. To
The last table would be reservations which has these fields.
1. ResID
2. ShiftID
3. Datex
4. Timex
4. Comments
What I want to do is create shifts on the fly using fields in the database.
Initially there would be three of them.
When a user reserves a room in the scheduling program, he enters the time and submits the record to the database. I want the application to enter a shiftID based on the time the user wants to reserve the room.
Can anyone point me in the right direction???
|
|
|
kenlyle
|
Posted: 01/11/2002, 1:38 PM |
|
If your shifts are the usual, Midnight, 8 a.m., 4 p.m., then you could do a an int(Hour/8) to get 0 for Midnight shift, 1 for 'daylight', 2 for 4-12.
HTH.
|
|
|
jake o
|
Posted: 01/11/2002, 1:45 PM |
|
What a concept. Anyone know how to do this? I'm kinda curious too.
|
|
|
Brent
|
Posted: 01/11/2002, 2:35 PM |
|
If you have a MySQL table with a datetime column D1, it would look like this:
select floor(extract(hour from d1)/3) from mytable;
or
select floor(hour(d1)/3) from mytable;
This assumes your shift starts at midnight. If not, then you can use
hour(adddate(d1, interval -2 hour)) to subtract 2 hours if the first shift
is at 2AM.
|
|
|
|