From c8d72ce4aa1ca8fec41bf31b6cb419f4b75ce28f Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 16 Oct 2009 11:27:38 +0000 Subject: [PATCH] * Patch from Luiz Americo to fix access violation when transforming date field git-svn-id: trunk@13867 - --- packages/fcl-db/src/paradox/paradox.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/fcl-db/src/paradox/paradox.pp b/packages/fcl-db/src/paradox/paradox.pp index 491aa3d074..a89b0f1559 100644 --- a/packages/fcl-db/src/paradox/paradox.pp +++ b/packages/fcl-db/src/paradox/paradox.pp @@ -660,8 +660,11 @@ begin Result:=PX_get_data_long(FDoc,Buf,flen,@longv)>0; If Result then begin - PX_SdnToGregorian(longv+1721425,@Y,@M,@D); - PDateTime(Buffer)^:=EncodeDate(Y,M,D); + // 1721425 is the number of the days between the start of the + // julian calendar (4714 BC) and jan-00-0000 (Paradox base date) + // 2415019 is the number of the days between the start of the + // julian calendar (4714 BC) and dec-30-1899 (TDateTime base date) + PDateTime(Buffer)^:=Longv+1721425-2415019; end; end; pxfShort: