Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread What field type to use
Tue, Aug 19 2008 12:48 AMPermanent Link

"Adam H."
Hi,

I'm just wondering what field type anyone would recommend to store data that
is a time lapse based which could hold hours or days.

To explain a little better, we need to record how long something is stored
for. It may be recorded in hours or days only. (And could be up to 30 days).
No need for weeks, etc.

Ideas I've come up with are:

1) Use a Double type field and specify the time in days (with hours being a
fraction - similar to how a TDateTime field is stored)

2) Use a TDateTime field with the value being time between 0 (midnight
1899-12-31)

or

3) Use two seperate integer fields (one for days, the other for hours) and
write validation script to change entry if user enters something like 28hrs,
etc.

Data entry needs to allow the user to specify hours (up to and past 96hrs)
or striaght days (such as 16 days).

It may be much or a muchness, or is there a specific standard to store such
data?

Thanks & Regards

Adam.
Tue, Aug 19 2008 11:05 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< 3) Use two seperate integer fields (one for days, the other for hours)
and write validation script to change entry if user enters something like
28hrs, etc. >>

I would use 3) since it is closest to standard SQL date-time intervals,
which is what EDB and other database engines use that implement the SQL
interval types.  This will give your more portability in the future also,
since all database engines support integers and you don't have to try to
split out float fields in SQL or filters.

<< It may be much or a muchness, or is there a specific standard to store
such data? >>

Yep, date-time intervals.  You can read more about them here:

http://www.elevatesoft.com/manual?action=mantopic&id=edb2sql&category=2&topic=35

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Aug 19 2008 8:34 PMPermanent Link

"Adam H."
Good Morning Tim,

Thanks for your advise. Two seperate integer fields it is then!  Smile

Have a great day!

Adam.
Image