
The built-in ABAP types D and T allow you to represent a day and a time respectively. Dates always have the format YYYYMMDD, regardless of the output format of the user. Times always have the format HHMMSS in 24-hour clock notation, regardless of the output format of the user. Times are accurate to 1 second.
System Information for Time and Date
The class cl_abap_context_info provides methods that you can use to find out current time and date information.
Date and Time Calculations

In ABAP, you can perform direct date calculations such as finding the difference between two dates or adding and subtracting a number of days from a given date. To perform the calculation, ABAP converts the dates into an integer (the number of days since 01.01.0001) and adds or subtracts the relevant values. When performing time calculations, ABAP converts the time into the number of seconds since midnight.
Using Offset and Length with Date Fields

ABAP stores dates in the format YYYYMMDD. You can access individual components of the date using offset and length. To access the month, for example, you need the fifth and sixth characters of the date field. You can do this by specifying var_date+4(2), which tells the system to go four characters into the date, then take the next two characters. The access to year, month, and day is then as follows:
- Year: var_date(4)
- Month: var_date+4(2)
- Day: var_date +6(2)
Using Timestamp Fields
As well as the type D, ABAP has a built-in data type utclong, which represents a timestamp according to ISO-8601. This data type has an accuracy of 100 nanoseconds and follows the format YYYY-MM-DDTHH:MM:SS.sssssssZ, where T is the delimiter between date and time, and Z denotes the time zone Zulu, which stands for UTC.