Timestamp on SAP - aidamate13/AMS-Knowledge-Base GitHub Wiki
How the timestamp is working and is calculating on SAP
The timestamps for example in table COEP are calculated based on the formula of "Seconds since 1.1.1990,0:00 GMT * 10000".
So the starting Date/Time for the seconds is the above.
To retrieve the timestamp you can use the FM:
"RKE_TIMESTAMP_CONVERT_INPUT"
In case you want to remove some minutes from the Timestamp then we have to divide the value with 10.000 (convert from milliseconds to second) and then minus the Minutes * 60 (to be converted to seconds).
After that you have successfully remove the minutes from the timestamp.
To convert it back to milliseconds multiple by 10.000.
DATA: from_tst TYPE cest1-timestmp.
CALL FUNCTION 'RKE_TIMESTAMP_CONVERT_INPUT'
EXPORTING
i_date = sy-datum
i_dayst = '0'
i_time = sy-timlo
i_tzone = sy-tzone
IMPORTING
e_timestmp = from_tst.
from_tst = ( from_tst / 10000 ) - ( p_min * 60 ).
from_tst = from_tst * 10000.