Subject Re: [firebird-support] time subtraction problem
Author Helen Borrie
At 13:33 8/10/2008, you wrote:
>hello.
>
>i have 2 times stored in the database and i want to subtract them. but
>i want to ignore the hundredths of the second.
>
>var_start_time = 16:06:00
>var_end_time = 16:10:00
>
>declare variable var_seconds decimal(9,4);
>
>var_seconds = var_end_time - var_start_time;
>
>this is giving me a value of 240.7960 which is because it is taking
>the hundredths of a second into account.
>
>what i want to get here is 240 flat.
>
>ive tried casting (rounds up) and am wondering if i need to recreate 2
>new time vars based on my originals. any help appreciated thanks

truncate() UDF in fbudf for versions < 2.1, otherwise trunc() internal function.

And I guess you're aware that subtracting a TIME type from a TIME type is going to cause problems at the turn of the day...?

./heLen