[Lazarus] date function db_date();
Larry Dalton
larrydalton71 at gmail.com
Tue Jul 5 05:23:14 CEST 2016
I use the following function to read a date from a Libre Office dbase file.
The field is stored as
a string, ie '04/08/2016'.
function db_date(const dog_base:tdbf;const t_field:string):tdatetime;
var test_date:tdatetime;
test_bool:boolean;
test_string:string;
begin {starts function db_date(const dog_base:tdbf;const
t_field:string):tdatetime;}
test_bool:=dog_base.FieldByName(t_field).Value<>null;
if test_bool then test_date:=dog_base.FieldByName(t_field).AsDateTime
else test_date:=now;
result:=test_date;
end; {ends function db_date(const dog_base:tdbf;const
t_field:string):tdatetime;}
I am running lazarus 1.6, on both Windows 8 and Linux Mint 17. The above
function works fine on the Windows 8 box, but on the Linux Mint box, I get
the following error: “04/08/2016” is not a valid date format. Why does it
work on Windows but not Linux? How can I rewrite it to work on both?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160704/939a1da6/attachment.html>
More information about the Lazarus
mailing list