ABAP_DATE_TIME
**********************************************
**DATES IN SAP
DATA: today TYPE D,
some_day TYPE D VALUE '20120909',
diff_int TYPE I,
diff_year_int TYPE I,
mod_int TYPE I.
today = SY-DATUM.
WRITE: / today.
diff_int = today - some_day.
WRITE: / diff_int.
diff_year_int = diff_int / 365.
WRITE: / diff_year_int.
* To calculate exact yaer difference
mod_int = diff_int MOD 365.
diff_int = diff_int - mod_int.
diff_int = diff_int / 365.
* Diff will be calculated in days
WRITE: / diff_int.
* To calculate exact number of days
WRITE: / 'Number of years: ', diff_int, 'Number of days: ', mod_int.
* Update date
* Skip 6, access 2, set 2 equal to fifteen
today+6(2) = '15'.
WRITE / today.
abapdate.abap - date manipulation
abaptime.abap - time manipulation
**********************************************
* TIME MANIPULATION IN ABAP
DATA: now TYPE T,
another_time TYPE T VALUE '060543',
diff_inttime TYPE I.
* Store current time
now = SY-TIMLO.
WRITE: / now.
* Adding to time
now = now + 60.
WRITE: / now.
* Diff will be given in seconds
diff_inttime = now - another_time.
WRITE: / diff_inttime.
diff_inttime = diff_inttime / 60.
WRITE: / diff_inttime.
diff_inttime = diff_inttime / 60.
WRITE: / diff_inttime.
* Skip ver first two, edit minutes
now+2(2) = 08.
WRITE / now.