[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: DateAdd / StrToDate problem.
- Subject: Re: DateAdd / StrToDate problem.
- From: James Womeldorf <jwomeldo@FASTENAL.COM>
- Date: Thu, 10 Jan 2002 07:09:15 -0600
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.