Author | Topic: Leap year error in Excel or Xbase++? | |
---|---|---|
John D. Sauvigne | Leap year error in Excel or Xbase++? on Thu, 14 Feb 2008 17:57:20 -0500 Hi, When I read a date of "2008-02-29" or "02/29/08" from an xls or csv file via Excel ActiveX I get random wrong results such as "02/13/2008" or "02/28/2008". Is this a leap year bug in Excel or a bug in Xbase++ (or a bug in my logic?) Attached is a demonstration program file and the xls and csv test files. Csv File: " :","Column A ","Column B ","Column C " "Row 1:","2008-02-27","02/28/08","02/29/08" "Row 2:","2008-02-28","02/29/08","03/01/08" "Row 3:","2008-02-29","06/29/04","05/29/07" "Row 4:","2008-02-29","01/04/08","00/00/00" "Row 5:","2008-02-29","09/17/07","12/21/07" "Row 6:","2008-02-29","11/02/06","12/31/07" "Row 7:","2008-03-02","03/02/07","10/02/07" "Row 8:","2008-03-05","12/20/07","00/00/00" Results: : Column A Column B Column C Row 1: 02/27/2008 02/28/2008 02/28/2008 Row 2: 02/28/2008 02/28/2008 03/01/2008 Row 3: 02/13/2008 06/29/2004 05/29/2007 Row 4: 02/13/2008 01/04/2008 00/00/00 Row 5: 02/13/2008 09/17/2007 12/21/2007 Row 6: 02/13/2008 11/02/2006 12/31/2007 Row 7: 03/02/2008 03/02/2007 10/02/2007 Row 8: 03/05/2008 12/20/2007 00/00/00 Note that in the results grid, the dates in A3, A4, A5, A6, B2 and C1 should be the leap year date of 02/29/2008! Can anyone confirm this for me? Anyone know of any work around? Thanks, John. BTW: Xbase++ 1.90.331, XP Pro, and Excel 2002 (10.6834.6830) SP3 installed. datetest.prg datetest.xls datetest.csv | |
Joe Carrick | Re: Leap year error in Excel or Xbase++? on Thu, 14 Feb 2008 15:24:10 -0800 Hi John, I don't think this is an Xbase++ problem. ctod("02/29/2008") always returns a date of 02/29/2008 on my system. Have you actually printed the character values in the original data? John D. Sauvigne wrote: > Hi, > > When I read a date of "2008-02-29" or "02/29/08" from an xls or csv file > via Excel ActiveX I get random wrong results such as "02/13/2008" or > "02/28/2008". Is this a leap year bug in Excel or a bug in Xbase++ (or a > bug in my logic?) > > Attached is a demonstration program file and the xls and csv test files. > > Csv File: > " :","Column A ","Column B ","Column C " > "Row 1:","2008-02-27","02/28/08","02/29/08" > "Row 2:","2008-02-28","02/29/08","03/01/08" > "Row 3:","2008-02-29","06/29/04","05/29/07" > "Row 4:","2008-02-29","01/04/08","00/00/00" > "Row 5:","2008-02-29","09/17/07","12/21/07" > "Row 6:","2008-02-29","11/02/06","12/31/07" > "Row 7:","2008-03-02","03/02/07","10/02/07" > "Row 8:","2008-03-05","12/20/07","00/00/00" > > Results: > : Column A Column B Column C > Row 1: 02/27/2008 02/28/2008 02/28/2008 > Row 2: 02/28/2008 02/28/2008 03/01/2008 > Row 3: 02/13/2008 06/29/2004 05/29/2007 > Row 4: 02/13/2008 01/04/2008 00/00/00 > Row 5: 02/13/2008 09/17/2007 12/21/2007 > Row 6: 02/13/2008 11/02/2006 12/31/2007 > Row 7: 03/02/2008 03/02/2007 10/02/2007 > Row 8: 03/05/2008 12/20/2007 00/00/00 > > Note that in the results grid, the dates in A3, A4, A5, A6, B2 and C1 > should be the leap year date of 02/29/2008! > > Can anyone confirm this for me? Anyone know of any work around? > > Thanks, > > John. > > BTW: Xbase++ 1.90.331, XP Pro, and Excel 2002 (10.6834.6830) SP3 installed. > | |
Klaus Overhage | Re: Leap year error in Excel or Xbase++? on Fri, 15 Feb 2008 06:53:06 +0100 John, Alaska know it and has a bugfix for this. John D. Sauvigne schrieb: > Hi, > > When I read a date of "2008-02-29" or "02/29/08" from an xls or csv file > via Excel ActiveX I get random wrong results such as "02/13/2008" or > "02/28/2008". Is this a leap year bug in Excel or a bug in Xbase++ (or a > bug in my logic?) > > Attached is a demonstration program file and the xls and csv test files. > > Csv File: > " :","Column A ","Column B ","Column C " > "Row 1:","2008-02-27","02/28/08","02/29/08" > "Row 2:","2008-02-28","02/29/08","03/01/08" > "Row 3:","2008-02-29","06/29/04","05/29/07" > "Row 4:","2008-02-29","01/04/08","00/00/00" > "Row 5:","2008-02-29","09/17/07","12/21/07" > "Row 6:","2008-02-29","11/02/06","12/31/07" > "Row 7:","2008-03-02","03/02/07","10/02/07" > "Row 8:","2008-03-05","12/20/07","00/00/00" > > Results: > : Column A Column B Column C > Row 1: 02/27/2008 02/28/2008 02/28/2008 > Row 2: 02/28/2008 02/28/2008 03/01/2008 > Row 3: 02/13/2008 06/29/2004 05/29/2007 > Row 4: 02/13/2008 01/04/2008 00/00/00 > Row 5: 02/13/2008 09/17/2007 12/21/2007 > Row 6: 02/13/2008 11/02/2006 12/31/2007 > Row 7: 03/02/2008 03/02/2007 10/02/2007 > Row 8: 03/05/2008 12/20/2007 00/00/00 > > Note that in the results grid, the dates in A3, A4, A5, A6, B2 and C1 > should be the leap year date of 02/29/2008! > > Can anyone confirm this for me? Anyone know of any work around? > > Thanks, > > John. > > BTW: Xbase++ 1.90.331, XP Pro, and Excel 2002 (10.6834.6830) SP3 installed. | |
John D. Sauvigne | Re: Leap year error in Excel or Xbase++? on Fri, 15 Feb 2008 09:06:10 -0500 Hi Klaus, Thank you. I will contact Alaska for the bugfix. John. ------------------------- Klaus Overhage wrote: > John, > > Alaska know it and has a bugfix for this. > | |
John D. Sauvigne | Re: Leap year error in Excel or Xbase++? PDR ID #5624 on Fri, 15 Feb 2008 09:23:41 -0500 The PDR ID is #5624 for this issue: If a date value of 2/29/2000 is stored in a member variable of a COM/ActiveX objects, reading the same value may produce an incorrect result. The same problem may occur if a date value of 2/29/2000 is returned by a COM/ActiveX method. Instead of the value 2/29/2000, a different date, such as 2/20/2000 is returned. Closed Build: 1.90.334 Close Date: 27.04.2007. | |
Rodd Graham | Re: Leap year error in Excel or Xbase++? PDR ID #5624 on Fri, 15 Feb 2008 19:52:23 +0000 Hello John, > The PDR ID is #5624 for this issue: > > If a date value of 2/29/2000 is stored in a member variable of a > COM/ActiveX objects, reading the same value may produce an incorrect > result. The same problem may occur if a date value of 2/29/2000 is > returned by a COM/ActiveX method. Instead of the value 2/29/2000, > a different date, such as 2/20/2000 is returned. > Closed Build: 1.90.334 > Close Date: 27.04.2007. Does anyone know how to coorelate the hotfixes with the build number? Obviously the hotfixes update Xbase++, but it is hard to know if they include the solution to this PDR since the PDR is based upon build numbers. The hotfix web page at Alaska does list specific PDR's included in the fixes, but does not say whether that is all that is included. Nearly a year from the last hotfix, it is probably time for a service level release to receive the last years fruits from Alaska. Regards, Rodd Graham, Consultant Graham Automation Systems, LLC |