Page 1 of 1
dbedit type 28/02/2006 after the post it shows 31/12/1899
Posted: 28.02.2006, 19:13
by silviogs
dbedit type 28/02/2006 after the post it shows 31/12/1899
use Lazarus 0.9.12, Zeoslib 6.5.1 cvs and PostgreSQL 8.1.3, have an application that I type a date in the pattern dd/mm/yyyy in the dbedit and does it come back me 31/12/1899, in the database it does show 0001-12-30 BC, where is the error?
in Dataset of Dbedit or in Zeoslib?
respectfully
Silvio Guedes
Posted: 01.03.2006, 09:28
by pol
For Delphi's Tdatetime 31/12/1899 is just zero (you remember, digits in front of decimal separator: date, behind decimal separator: time). What's the "starting point" (zero) for PostgreSQL? Maybe 0001-12-30 BC? That would mean that the value gets lost on the way to the database.
I remember having read here about problems with date conversion ("old" format vs. "new" format) in the combination of Zeos/Lazarus/FPC/PostgreSQL, and somebody had a patch for that.
Regards,
RĂ¼diger
Posted: 01.03.2006, 16:21
by ste_ba
I always enter date values as yyyy-mm-dd which seems to cause no problem with any dbms. Have you checked the Postgres documentation for valid date formats? Maybe it doesn't support dd/mm/yyyy at all? Can you switch to yyyy-mm-dd or maybe use a non-db-sensitive TEdit and then parse the date to the other format before sending it to the database?
Stefan
Posted: 01.03.2006, 17:10
by silviogs
Hello Stefan
how does it can in Delphi 7 the dbedit to work perfectly well and in Lazarus this does happen?
the format of date dd/mm/yyyy in the delphi 7 works because the date is recorded correctly, I type 01/03/2006 in the delphi with the dbedit he records in the postgres 03/01/2006, because in the postgres the format is mm/dd/yyyy in the case using the pgadmin.
could you help me?
after I met the tools opensource I don't intend to never again abandon them, and to contribute in the best possible way for your growth.
Respectfully
Silvio Guedes
Posted: 02.03.2006, 19:07
by z1
Hello,
I have same problem with the component Zeos (6.5.1 Alpha) using the Lazarus 0.9.10 and Firebird 1.5. The others data access components return de date correct, but zeos return only 30/12/1899 for any date.
Marcos Roberto Ribeiro
Posted: 02.03.2006, 20:52
by ste_ba
At least we can locate the problem now.. Unfortunately, I do not have Lazarus. If I may pass the question on to someone who does..
However, have you tried to use yyyy-mm-dd as a workaround?
If all else fails, I'd try using a non-sensitive TDateTimePicker, read the date from the db on formshow and write the altered date with an UPDATE statement using the execSQL method, e.g.
Code: Select all
UPDATE yourtable SET datecol='2006-02-28' WHERE primarekeycol=xy
I admit it's not exactly elegant, but it might help.
Stefan