Hi,
I have a string for eg 08. I need to convert it into year and get the previous year.
I tried OUT=DateToString((StringToDate(PAR_ERT_YY,"%yy")-1)) and OUT column is a varchar (2).
I get an error while compiling...
Invalid conversion requested from a dfloat to a date.
Can anyone help me on this?
Thanks,
Harshada
Get previous year from the string
Moderators: chulett, rschirm, roy
Hi,
I took a stage variable SvDate as date and
SvDate=StringToDate(CurrentDate() [1,2] : PAR_ERT_YY,"%yyyy")-1
where PAR_ERT_YY will have value of year for eg 08.
Then in the OUT column i use SvDate.
But still I get the same error
Invalid conversion requested from a dfloat to a date.
Why is it saying dfloat when my input is a string and output is a date
I took a stage variable SvDate as date and
SvDate=StringToDate(CurrentDate() [1,2] : PAR_ERT_YY,"%yyyy")-1
where PAR_ERT_YY will have value of year for eg 08.
Then in the OUT column i use SvDate.
But still I get the same error
Invalid conversion requested from a dfloat to a date.
Why is it saying dfloat when my input is a string and output is a date
Hi,
I took a stage variable SvDate as date and
SvDate=StringToDate(CurrentDate() [1,2] : PAR_ERT_YY,"%yyyy")-1
where PAR_ERT_YY will have value of year for eg 08.
Then in the OUT column i use SvDate.
But still I get the same error
Invalid conversion requested from a dfloat to a date.
Why is it saying dfloat when my input is a string and output is a date
I took a stage variable SvDate as date and
SvDate=StringToDate(CurrentDate() [1,2] : PAR_ERT_YY,"%yyyy")-1
where PAR_ERT_YY will have value of year for eg 08.
Then in the OUT column i use SvDate.
But still I get the same error
Invalid conversion requested from a dfloat to a date.
Why is it saying dfloat when my input is a string and output is a date
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Because intermediate arithmetic results are dfloat. The result of StringToDate() has to be converted to a numeric data type (dfloat) before 1 can be subtracted from it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.