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

Re: [sqr-users] brain dead?



SQR and date handling has always been a little squirrilly....

However I suspect that you need to declare a variable as type date to get the 
comparision to work properly.
Another alternative to convert the yyyymmdd string to a number which will 
compare correctly (assuming the yyyymmdd format).

date variables must be declared. They do being with the dollar sign character. 
This declaration is required to have sqr perform date calculations. And given a 
comparision is a form of a data calculation, my assumption (meaning I've not 
tested this) is you need the same declaration for your $datex variable 
comparisions.
begin-setup
  declare-variable
       date $date1
       date $date2... 
  end-declare
end-setup



>>> timmbuck2@gmail.com 06/23/04 11:16AM >>>
OK...I am using strtodate, and getting the exact same results....

Actual procedure:
begin-procedure report


let $date1 = strtodate('20031108', 'YYYYMMDD')
let $date2 = strtodate('20040108', 'YYYYMMDD')
let $fromdate = strtodate('20040102', 'YYYYMMDD')
let $thrudate = strtodate('20040116', 'YYYYMMDD')


display '$date1 'noline 
display $date1 
display '$date2 'noline 
display $date2 
display '$fromdate 'noline 
display $fromdate 
display '$thrudate 'noline 
display $thrudate 


if $date1 >= $fromdate
        display 'date 1 >= fromdate'
end-if

if $date2 >= $fromdate
        display 'date 2 >= fromdate'
end-if

if $date1 <= $thrudate
        display 'date 1 <= thrudate'
end-if

if $date2 <= $thrudate
        display 'date 2 <= thrudate'
end-if

if $date1 <= $fromdate
        display 'date 1 <= fromdate'
end-if

if $date2 <= $fromdate
        display 'date 2 <= fromdate'
end-if

if $date1 >= $thrudate
        display 'date 1 >= thrudate'
end-if

if $date2 >= $thrudate
        display 'date 2 >= thrudate'
end-if


end-procedure



results:
$date1 08-NOV-2003
$date2 08-JAN-2004
$fromdate 02-JAN-2004
$thrudate 16-JAN-2004
date 1 >= fromdate
date 2 >= fromdate
date 1 <= thrudate
date 2 <= thrudate

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org 
http://www.sqrug.org/mailman/listinfo/sqr-users


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users