dbedit type 28/02/2006 after the post it shows 31/12/1899

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
silviogs
Junior Boarder
Junior Boarder
Posts: 42
Joined: 24.08.2005, 12:54
Location: The Most Oriental Point of America - João Pessoa - Brazil
Contact:

dbedit type 28/02/2006 after the post it shows 31/12/1899

Post 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
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post 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
User avatar
ste_ba
Zeos Dev Team
Zeos Dev Team
Posts: 29
Joined: 15.02.2006, 20:26
Location: Lahntal
Contact:

Post 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
silviogs
Junior Boarder
Junior Boarder
Posts: 42
Joined: 24.08.2005, 12:54
Location: The Most Oriental Point of America - João Pessoa - Brazil
Contact:

Post 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
z1
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 02.03.2006, 18:26

Post 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
User avatar
ste_ba
Zeos Dev Team
Zeos Dev Team
Posts: 29
Joined: 15.02.2006, 20:26
Location: Lahntal
Contact:

Post 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
Post Reply