Writing to datetime field in dbf lazarus / 16-Databases ---------------------------------------------------------------------- wp · 2016-07-23 19:45 Here's another issue that I stumbled across. TDbf fails to post a datetime field. Please run this code, it will crash with a SIGFPE in the line where the current date is assigned to the field: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1; {$mode objfpc}{$H+} uses  SysUtils, Classes, dbf, dbf_common, db, LazFileUtils; var  Dbf1: TDbf; begin  ForceDirectories('data');  DeleteFile(AppendPathDelim('data') + 'table1.dbf');   Dbf1 := TDbf.Create(nil);  try    Dbf1.FilePath := AppendPathDelim('data');    Dbf1.TableLevel :=7;    Dbf1.Exclusive := True;    Dbf1.TableName := 'table1.dbf';//    Dbf1.DateTimeHandling := dtDateTime;         /// no effect//    Dbf1.DateTimeHandling := dtBDETimeStamp;    With Dbf1.FieldDefs do begin      Add('Date', ftDateTime, 0, false);   // no issue with ftDate    end;    Dbf1.CreateTable;    Dbf1.Open;    Dbf1.Append;    Dbf1.FieldByName('Date').AsDateTime := now;     // <-- SIGFPE here    Dbf1.Post;  finally    Dbf1.Free;  end;   ReadLn;end. Changing the DateTimeHandling mentioned in the manual has no effect. The table, however, is posted without issues if the field is created as a ftDate field - but of course this strips the time part. Could it be that TDbf does not support date/time fields? But according to http://wiki.freepascal.org/Lazarus_Tdbf_Tutorial#Adding_fields it does. ---------------------------------------------------------------------- LuizAmérico · 2016-07-23 21:23 A bug was fixed recently. http://bugs.freepascal.org/view.php?id=28734 Can you try trunk? ---------------------------------------------------------------------- wp · 2016-07-23 22:39 Yes, the bug is fixed in fpc trunk - thanks for the hint.