Subject Re: [ib-support] COMPUTED FIELD BY SUBTRACTING TWO TIME FIELDS
Author Ali Gokcen
Arnoldo,
sorry me about my shortcut  expression,
i like to show how catch it instead of  to give ready fish.   ;)
 
CREATE TABLE TIMEDELTA     
         (
            T1                TIME,  // start time
            T2                TIME,  // stop time
            DELTA_HM  COMPUTED BY ( CAST('00:00:00' as time) + (t2-t1))     // delta as HH:MM:SS
          );
you can use like my ex. above.  SP will inc. your apps complexty.
 
good luck.
 
----- Original Message -----
From: Arnaldo
Sent: Sunday, January 28, 2001 8:36 PM
Subject: R: [ib-support] COMPUTED FIELD BY SUBTRACTING TWO TIME FIELDS

Solved. Thanks to Ali Gokcen.
 
Your reply is a full understand to me.
 
this line:
select cast('00:00' as time) + (cast('12:22' as time)  - cast('10:20' as time)) from rdb$database; 
seems don't work in computed fields so I have set up a Stored Procedure and seem all woks fine.
 
again thanks Ali.
 
Arnaldo 
----- Original Message -----
From: Ali Gokcen
Sent: Sunday, January 28, 2001 2:48 PM
Subject: Re: [ib-support] COMPUTED FIELD BY SUBTRACTING TWO TIME FIELDS

select cast('00:00' as time) + (cast('12:22' as time)  - cast('10:20' as time)) from rdb$database; 
 
it works.
 
but,
 
cast(  cast('12:22' as time)  - cast('10:20' as time)   as time)   not.
 
its returning  seconds. so, you can calculate it yourself too   
                       (firsttime-secondtime )/3600   is hour,
                    (int) (((firstime-secondtime)-(int(hour) * 3600) ) / 60)    is minute..
 
----- Original Message -----
From: Arnaldo
Sent: Sunday, January 28, 2001 10:43 AM
Subject: [ib-support] COMPUTED FIELD BY SUBTRACTING TWO TIME FIELDS

Hi all.
 
There is a way to subtract two fields ot type TIME in a computed fields?
 
I have 2 fields say: 'FIRSTHOUR' and a second 'SECONDHOUR':
 
if i do:
WHOUR = COMPUTED BY ( SECONDHOUR - FIRSTHOUR ) but i got a COMPUTED numeric field:
 
HOW EXTRACT TIME FROM THIS FIELD???
 
THANKS
 
Arnaldo


To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com




To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com




To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com