Subject Re: [firebird-support] Re: time data type and elapsed
Author Lucas Franzen
steve_carter_ben schrieb:

> Helen,
> Thanks for your responce, but I can see I did not make myself clear.
> It is not the fields of type date that are giving me trouble, but
> the fields of type time.
> For example, I have a field 'timeofpickup' with value '530 PM' and a
> field 'timeofdropoff' with a value of 1:30 AM.
> (I realize that internally these are stored as integers representing
> milliseconds since midnight).
> I can, of course do the following:
> select
> timeofpickup, timeofdropoff,
> (timeofdropoff - timeofpickup)...
> but that gives me the unuseful value of -57600
> <grin>.

Which is perfectly ok since a time field doesn't store the day - it's a
time field not a datetime field.
If you are sure that the difference between these fields is less tahn
one day (otherwise you have to use the crystal bowl function) how about
adding the value for one day if your result is less than zero?

One day = 24 hours * 60 minutes * 60 seconds = 86400 seconds.

if you add 86400 to -57600 you'll get 28860 seconds which is exactly 8

You can use (for example) stored proc to check for results below zero.