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

Internal Date Processing - Y2K problems



Help!  I was under the impression that all internal date processing was done
using the full 4-digit year, but I have just uncovered a problem that seems
to indicate otherwise.  I am using the following code:

BEGIN-PROCEDURE Calc-Ben-Age
BEGIN-SELECT
round(months_between(&a.ben_cmdt_date,&d.birthdate)/12,5) &age
   let $line40 = ltrim(edit(&age,'999.99999'),' ')
from ps_installation
END-SELECT
END-PROCEDURE

The dates were retrieved in former selects, and their values in this
instance are 8/1/2009 and 11/12/1940.  I am getting a negative number as the
age (-31.27957) - the right age if the benefit commencement date were
8/1/1909!  I realize that SQR (I am still on version 3) does not handle
dates very well, and you have to treat them as strings, but I thought that
everything was fine if they were retrieved in one SQL select and the exact
column name retrieved was used in another (used in SQL code, not SQR).  Am I
missing something or just completely off-base in my assumptions?  This is
going to have BIG repercussions if I have to revise dozens of programs!  I
imagine I will have to convert all dates retrieved to strings with the full
year, and then reconvert them using TO_DATE in my SQL date calculations, but
it seems I shouldn't have to do this.

Thanks in advance!
Denise White
Textron Systems
dwhite@systems.textron.com