[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Bug in Date Handling



Yes, this is a known bug in SQR, depending on the version of SQR you are using.
I use 4.3.4 and have this bug.  Supposedly, it was fixed in a later release.
What I did to work around this problem is to convert the dates being compared to
a julian date format (YYYYDDD) and then compare those 2 values.





"Beller, Jay" <JBeller@LBISOFTWARE.COM> on 04/12/2001 01:31:54 PM

Please respond to sqr-users@list.iex.net

To:   SQR-USERS@list.iex.net
cc:    (bcc: Rick Creel/IT/Aon Consulting)

Subject:  Bug in Date Handling



Has anyone found SQR mishandling comparing two DATE fields when one of them
is the last day of a month and the other is the first day of the next month?
We're finding that SQR thinks these dates are the same - quite a serious
problem!

Here's a short program to demonstrate. If your version of SQR has the bug,
you should see every end-of-month date appear.

Thanks ... Jay Beller
===========================================

Begin-Setup
Declare-Variable
   Date $CC_Curr_Date
   Date $CC_Prev_Date
End-Declare
End-Setup

Begin-Program
   do CC-Main
End-Program

Begin-Procedure CC-Main
   SHOW 'Comparing Dates from 1/1/1999 forward...'
   show '========================================================='

   let #i = 0
   let $CC_Prev_Date = strtodate( '01/01/1999', 'MM/DD/YYYY' )

   while #i < 3000
      let $CC_Curr_Date = dateadd( $CC_Prev_Date, 'DAY', 1 )
      do compare-dates-wrong
      add 1 to #i
      let $CC_Prev_Date = $CC_Curr_Date
   end-while
End-Procedure CC-Main

begin-procedure compare-dates-wrong
   if $CC_Prev_Date = $CC_Curr_Date
      show
         $CC_Prev_Date edit 'MM/DD/YYYY HH:MI:SS am'
         ' = '
         $CC_Curr_Date edit 'MM/DD/YYYY HH:MI:SS am'
   else
      if $CC_Prev_Date > $CC_Curr_Date
         show
            $CC_Prev_Date edit 'MM/DD/YYYY HH:MI:SS am'
            ' > '
            $CC_Curr_Date edit 'MM/DD/YYYY HH:MI:SS am'
      end-if
   end-if
end-procedure