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

dateadd problem



I have a problem that should be easy to fix, but I'm stuck.

I simply want to add 2 months to a date. My code is as follows:

let $run_day = edit(Datenow(),'DD')
    if $run_day != '05'
        let $chart_for_date = dateadd(datenow(),'month',1)
        print $chart_for_date (+1,1)  edit 'Month YYYY'
    else
        let $chart_for_date = Datenow()
        print $chart_for_date (+1,1)  edit 'Month YYYY'
    end-if

    let $chart_thru_date = dateadd($chart_for_date,'month',2)
    print $chart_thru_date  (+1,1)

When I try to run I get the following error message:

Error on line 282:
   (SQR 4045) Function or operator 'dateadd' requires date argument.

As you can see, if I use Datenow() for the date value, it works. Otherwise,
I get the error
and am having to write unnecessary lines of code.


Thanks a ton,

B
The Programmer formally known as Bob
Mediware Information Systems Inc.
(913) 307-1045
Bob.Helm@Mediware.com