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

Re: Working with assigned dates.



Hi Ken,

The reason why you are getting a literal string comparison is because the 
variables holding your date are indeed string variables. Dates should be stored 
in a date variable. You can declare a date variable using the DECLARE-VARIABLE 
command:

begin-setup
  declare variable
  date $ONE_DT $TWO_DT
  end-declare
end-setup

Hope this helps.

-emil

-----Original Message-----
From: Ken Boettger [mailto:BoettgeK@CWU.EDU]
Sent: Tuesday, April 30, 2002 7:40 AM
To: SQR-USERS@list.iex.net
Subject: Working with assigned dates.


Working with dates:

This is confusing. The following yields "ONE DATE IS GREATER".  I am getting a 
literal string comparison rather than a date comparison. Can someone explain 
why and how I can correct the code to perform a date comparison?

            LET $ONE_DT = STRTODATE('01-JAN-2002')
            LET $TWO_DT = STRTODATE('01-FEB-2002')
            IF $ONE_DT > $TWO_DT
               SHOW 'ONE DATE IS GREATER'
            ELSE
               SHOW 'TWO DATE IS GREATER'
            END-IF

-Ken


Ken Boettger
boettgek@cwu.edu
http://www.cwu.edu/~boettgek
x2944