I'm working with an event calendaring system that keeps track of the
time an event starts and the time the event ends.  The Duration field
holds a decimal value equivalent to the length of time the event lasts.
Here is the description of the Schedule table which holds this field:

mysql> describe Schedule;
+--------------+------------------------------+------+-----+--------------------

-+-------+
| Field        | Type                         | Null | Key | Default
 | Extra |
+--------------+------------------------------+------+-----+--------------------

-+-------+
| EventID      | int(11)                      |      | PRI | 0
 |       |
| Location     | smallint(4) unsigned         |      | MUL | 0
 |       |
| LocationRoom | varchar(44)                  | YES  |     | NULL
 |       |
| TimeType     | enum('AllDay','Exact','TBA') |      |     | TBA
 |       |
| Instance     | datetime                     |      | PRI | 0000-00-00
00:00:00
 |       |
| Duration     | decimal(4,2)                 | YES  |     | NULL
 |       |
+--------------+------------------------------+------+-----+--------------------

-+-------+

I am trying to compute the end time by using the SEC_TO_TIME function in

my select statement.  First I want to multiply the Duration by 3600
(number of seconds in an hour) and then feed that value to the
SEC_TO_TIME function to get the time the event ends.

I'm seeing some discrepancy in the operation of the SEC_TO_TIME
function, however.  Let's say my Duration is a value of 9.25.  When I
multiply 9.25 by 3600, I get 33300.00.  When I use
SEC_TO_TIME(33300.00), it returns 09:15:00, the correct value.  But when

I try putting it all together in one query like this:  SELECT
SEC_TO_TIME(Duration * 3600) . . . it returns 09:00:00.  It appears that

the part of my Duration value behind the decimal point is being igored
when I attempt to retrieve the end time in one query.  Why
I would greatly appreciate any help!
--
#########################################
Kory Wheatley
Academic Computing Analyst Sr.
Phone 282-3874
#########################################
Everything must point to him.



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to