‎2007 Dec 10 9:47 AM
Hello,
How is type conversion done in a statement like
DATA: date type d,
string(10) type c.
date = string + 1.If string has the value "20071031", will 1 be added as a string (resulting in "200710311" which is then somehow converted to a date), like a number (resulting in "20071032" which is then somehow converted to a date) or like a date (resulting in "20071101")?
Regards,
Christoffer
‎2007 Dec 10 9:55 AM
Did you try typing it and running it?
DATA: date TYPE d,
string(10) TYPE c.
string = '20071031'.
date = string + 1.
WRITE: / date, string.Result: 00000000, 20071031.
( the intermediate result of "string + 1" will be 20071032, as it will be converted to a numeric for the "+1" operation ).
matt
‎2007 Dec 10 9:55 AM
Did you try typing it and running it?
DATA: date TYPE d,
string(10) TYPE c.
string = '20071031'.
date = string + 1.
WRITE: / date, string.Result: 00000000, 20071031.
( the intermediate result of "string + 1" will be 20071032, as it will be converted to a numeric for the "+1" operation ).
matt
‎2007 Dec 10 9:56 AM
Hey here nothing will come to Date.
The type conversion is not possible.
‎2007 Dec 10 10:11 AM
Why do you believe it's not possible?
There are three types involved: characters, date and integer. Conversion rules exist between all of these types.
Regards,
Christoffer
‎2007 Dec 10 10:30 AM
Hi,
Conversion rules exist between all of these types. but straight away u can not do this.
if the string is first converted as date field and then incremented
date = string .
date = date + 1.
u can get the result as 20071101
if string id incremented first and then u convert as date field u can get
string = 20071032 and date = 20071032 (not recommended )
the case u have discussed is not possible i think.