Time Stamps

The system fields for date and time are not sufficient for many requirements of determining unique points in time: They represent local times and the values are measured in seconds. For more exact date and time determination, you use time stamps.

Internal Format of Time Stamps

A time stamp represents date and time in the form YYYYMMDDHHMMSS. YYYY is the year, MM the month, DD the day, HH the hour, MM the minutes and SS the seconds. There is a short form and a long form. In the long form, the form specified above additionally contains seven decimal places for fractions of seconds, which allow for an accuracy of up to 100 ns. The maximum time resolution depends on the operating system of the application server and can be less.

A valid time stamp must contain values, whose date and time specifications before the decimal separator correspond to valid values for the data types d and t. When specifying the time, only the values 00 to 23 for the hours, and 00 to 59 for the minutes are valid. Time stamps in this form are always considered as UTC time stamps when processed with the corresponding statements. Use the statement GET TIME STAMP to create a time stamp that represents the current UTC reference time.

Data Types for Time Stamps

For the short and long form of time stamps, the data types TIMESTAMP and TIMESTAMPL are available in the ABAP Dictionary. The respective ABAP types are p of length 8 without decimal paces (short form) and p of length 11 with seven decimal places (long form). Time stamps are stored in the format stated above in data objects of these types. Thus the decimal places before the decimal separator represent the date and the time and the fractional portion in the long form represents the fractions of seconds.


In programs for which the program attribute Fixed point arithmetic is not set, beware of the rules applying for the data type p.

Using Time Stamps

Time stamps can be used to log points in time and to compare them. They are not suited for direct calculations or for date and time output. For calculations and display, you can convert time stamps into date and time fields of local time zones using the CONVERT TIME STAMP statement, or vice versa using the CONVERT DATE statement. For output to lists, use addition TIME ZONE of the WRITE statement. As of release 6.20, the system class CL_ABAP_TSTMP provides methods for adding, subtracting, converting and comparing time stamps.


Rules for Time Stamps

The conversion of the UTC reference time of a time stamp into the local time zone of an ABAP-Systems or a user is based on the set of rules stored in database tables. The names of the respective tables start with TTZ. The following database tables, whose content you can maintain using transaction STZBD, are relevant for time stamps:

For a correct set of rules, all rules specified in TTZZ for the time difference between time zones and the UTC reference time in TTZR and all rules specified for the summer time in TTZD must be contained. If the time difference between summer and winter time in TTZD is not equal to 0, the respective summer time rule must be contained in at least one of the tables TTZDF or TTZDV. While TTZDF contains fixed date specifications of the conversion, the date in TTZDV is variable, because a day in a particular week of a month is specified. The system always checks TTZDF first for the summer time rule and then TTZDV.

Notes for Summer Time

If in a time zone a summer time rule with a summer time difference not equal to 0 is defined, beware of the following:

At the summer time end, a time interval of a length of the summer time difference is created, which is passed twice as a local time (the double hour). If you formulate a date and time specification for this interval, the statement CONVERT DATE by default treats it as a time specification of summer time.