Subject Re: [firebird-support] Is it possible to insert an INTEGER into a TIME field?
Author Anderson Farias
Hi,

Use TIME fields only when you what to store a 'point in time' (on a day).
OTOH, if you whant to store an "amount of time" use INTEGER (or some
numeric) to store it in some unit defined by you (eg: minutes).

Later you can cast your TIME fields to timestamp and add your 'qty of
minutes' to it, ex:

select cast(mytimefield as timestamp)+(myminutesfield/1440.000000) from
table

(this is only an exemple, assuming myminutesfield is an integer containing
the amount of time in minutes)

the amount of zeroes after 1440 is the precision you what for the result


Regards,
Anderson

----- Original Message -----
From: "jeff_j_dunlap" <jeff_j_dunlap@...>
To: <firebird-support@yahoogroups.com>
Sent: Saturday, September 15, 2007 4:08 AM
Subject: [firebird-support] Is it possible to insert an INTEGER into a TIME
field?


I know that we can save time values to a time field as follows:
insert into test(T) values('10:15:00.0000')

But how (if possible) do I save the time's integer value? For example:
Note: 10:15 a.m. equals 369000000
insert into test(T) values('369000000')

In my application, I am working directly with Firebird's time fields
corresponding integer value. Since the time value is already in
integer form, I would be easy and eficient to just store the integer,
thus eliminating a conversion to FB followed a FB conversion back to
integer before saving to disk.

If this is not possible, I will just convert the integer into the
corresponding time string each time I need to save a time value.

Thank you