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

Re: DateAdd / StrToDate problem.



thanx!!

-----Original Message-----
From: Discussion of SQR, Brio Software's database reporting language
[mailto:SQR-USERS@list.iex.net]On Behalf Of James Womeldorf
Sent: Friday, 11 January 2002 12:09 AM
To: SQR-USERS@list.iex.net
Subject: Re: DateAdd / StrToDate problem.


Hi Jarrod,

Try the following:

begin-setup
  declare-variable
    date $TempDate
  end-declare
end-setup


begin-program
  Let $MyMonth  = '200111'

  Let $TempDateStr = $MyMonth || '01'
  Let $TempDate = strtodate($TempDateStr, 'YYYYMMDD')
  Let $TempDate = DateAdd($TempDate, 'month', -6)
  Let $HalfYear = DateToStr($TempDate)
  show $HalfYear
end-program

In order for a variable to 'really be a date' it has to be declared that way
either in the Setup section or as the first statement in a local procedure.

Jim

Jim Womeldorf
Programmer/Analyst
Fastenal Company
jwomeldo@fastenal.com
(507) 453-8250


-----Original Message-----
From: Jarrodb [mailto:jarrodb@NETSPACE.NET.AU]
Sent: Thursday, January 10, 2002 6:24 AM
To: SQR-USERS@list.iex.net
Subject: DateAdd / StrToDate problem.


Hi all!

Hoping someone can help.

I am trying to use the dateadd as seen below but are
getting the following errors.

Any tips would be greatly appreciated,
thanx.


  Let $MyMonth  = '200111'

  Let $TempDate = $MyMonth || '01'
  Let $TempDate = strtodate($TempDate, 'YYYYMMDD')
  Let $TempDate = DateAdd($TempDate, 'month', -6)
  Let $HalfYear = DateToStr($TempDate, 'YYYYMM')
Hi Jarrod


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

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

Errors were found in the program file.

SQR: Program Aborting.