from Firebird Database, SqlDb show Time as TDateTime lazarus / 16-Databases ---------------------------------------------------------------------- clauslack · 2009-08-31 18:37 I have a time field in Firebird 2.1 Flamerobin (with IBPP) show fine it as '10:47:22.000' SqlDb with - showmessage(SQLQuery1.FieldByName('hora').asstring); and with DBGrid show  '30/12/1899 10:47:22' Any idea? Some workarround for show fine in DBGrid? Tested with Lazarus 0.9.27 svn 21317 fpc 2.3.1 svn 13383 under Windows 2000 SP4. eDITED (2 SECONDS) Thanks. ---------------------------------------------------------------------- Loesje · 2009-08-31 19:20 Are you sure both times differ two seconds? To get rid of the date-part, you have to format the date (.asdatetime) as a time. ---------------------------------------------------------------------- clauslack · 2009-08-31 19:41 showmessage(TimeToStr(SQLQuery1.FieldByName('hora').AsDateTime)); show fine the time. Any idea for show fine in the DBGrid? Thanks ---------------------------------------------------------------------- clauslack · 2009-09-05 21:23 I found two workarround for this issue - use firebird timestamp field. - use fixed column in DBGrid with display format = hh:nn:ss ---------------------------------------------------------------------- clauslack · 2009-10-23 02:24 I found the best solution for DBGrid without fixed column. At runtime. Code: [Select]TColumn(DBGrid1.Columns[k]).DisplayFormat:='hh:mm:ss'; k= is the column with the time field. So I can use the same DBGrid with many querys. Regards ---------------------------------------------------------------------- LacaK · 2009-10-23 12:40 The root of problem may be, that Firebird SQL type of TIME is translated to ftDateTime field in ibconnection.pp SQL_TYPE_TIME :       TrType := ftDateTime; //here we should use ftTime ---------------------------------------------------------------------- clauslack · 2009-10-23 12:56 I will test that, because under Delphi time field show fine(for create a bugreport) Thanks ---------------------------------------------------------------------- clauslack · 2009-10-23 13:30 I recompile ibconnection.pp with SQL_TYPE_TIME :       TrType := ftTime; now dbgrid show 10:14 before showed 30/12/1899 10:14:31 with TColumn(DBGrid1.Columns[4]).DisplayFormat:='hh:mm:ss'; show 10:14:31 For me your patch is better, later I will create a a bug report. What do you think? Regards ---------------------------------------------------------------------- LacaK · 2009-10-26 06:52 Default DispalyFormat for ftTime fields is formated using global variable ShortTimeFormat (look in fields.inc) , which is "hh:mm" by default. In Delphi is for same purpose used LongTimeFormat, so you can submit also bug report - feature request to change default formating for ftTime fields from ShortTimeFormat to LongTimeFormat. You can change global varible ShortTimeFormat (ShortTimeFormat:=LongTimeFormat), in you program and you will get what you want. (I hope ;-))) ---------------------------------------------------------------------- clauslack · 2009-10-26 16:06 Report SqlDb show Time as TDateTime http://bugs.freepascal.org/view.php?id=14901 ---------------------------------------------------------------------- clauslack · 2009-10-31 23:18 Report http://bugs.freepascal.org/view.php?id=14960 About LongTimeFormat in time fields with SQLdb