Subject RE: [firebird-support] Extracting Time
Author Alan McDonald
> Then you are looking at a Delphi casting of "Day zero". This will be a
> number like 0.nnnnnnn (day zero from Firebird's p.o.v. would be
> midnight on
> November 17 189-something, but anyway, not the same zero-day as
> Delphi's,which you are looking at above). Your problem here is
> that Delphi
> doesn't have a TIME type so you have to cast Firebird's TIME type
> AsDateTime and define a display mask that doesn't look at the zero on the
> left side of the decimal point. You can use the display mask to hide the
> milliseconds too.
>
> >How do I get just the time from this field type - I've also
> tried many cast
> >attempts with no success other than truncation errors
>
> In dialect 3 you can do
> SELECT CAST (MyTimeStamp as TIME) as TimeOfDay, which will return a
> time-only value. You will get errors if you try to cast a DATE value as
> TIME, obviously. You can also use casting to extract a TIME and save it
> into a time type column, e.g.
>
> INSERT INTO ATABLE (TimeOfDay)
> values (cast(:Timestampvalue as time))
>
> heLen

Thanks Helen, but actually it's not Delphi at all. It's via ODBC and ASP
recordsets.
The cast statement returns milleseconds... pity - I'll have to do some
client side work on it.
It's a shame that the new dialect lost the simplicity of date and time being
exactly that when it added the new data types.

Alan