"shotokan99" <soft_devjava@[EMAIL PROTECTED]
> wrote in message
news:1140843728.083172.143400@[EMAIL PROTECTED]
> why is it in database desktop they only date data type. is there no
> time data type in dbase?
Because its design is very old.
If only Delphi programs will be accessing the table you can store
date/time
as a single Double. I would, however, suggest that you store them as
strings with a fixed known format such as "yyyymmddhhnnss". Its a
relatively simple task to write conversion functions.
function InternalDateTimeToDB (dt : tDateTime) : string;
begin
Result := FormatDateTime ('yyyymmddhhnnss", dt);
end;
function DBDateTimeToInternal (const st : string) : tDateTime;
begin
Result := EncodeDate (StrToInt (Copy (st, 1, 4)),
StrToInt (Copy (st, 5, 2)),
StrToInt (Copy (st, 7, 2))) +
EncodeTime (StrToInt (Copy (st, 9, 2)),
StrToInt (Copy (st, 11, 2)),
StrToInt (Copy (st, 13, 2)),
0);
end;
> so if im checking empty values with the use of ' ' - shall we say
> that's inaccurate, so what's the best way?
FYI Delphi's zero date & time is, IRC, 1899/12/30 0h00:00. If you were
using something like the above you could then write
if theDBField.AsString = InternalDateTimeToDB (0) . . .
or
if DBDateTimeToInternal (theDBField.AsString) = 0 . . .


|