abap - Storing result of date arithmetic in string -
the following code supposed subtract 10 days given date, store result in string variable , write it.
data str type string. data date type d. date = '20130418'. " 2013-04-18 str = date - 10. write str.
i expect output 2013-04-08 or @ least unformated 20130408. actual output quite mysterious number doesn't make sense me @ all:
734967
can explain me number comes from?
i found workaround (just put result in variable of type d , assign variable string), still interested in explanation strange result.
sap_basis release 702.
take @ conversion rules: substraction, date converted number of days since 01.01.0001 internally (source type date, target type i), arithmetics take place. if result date field, conversion (source type i/packed, target type d) form yyyymmdd applied. however, conversion i/packed string defined differently - string contains number of days between result date , 01.01.0001.
Comments
Post a Comment