ABAP does not contain a special data type for timestamps. Instead, they are stored in fields with data type P.
There is a short and a long form of the timestamp:
Short form: Type P, length 8 Bytes (for
example: 19981224235959)
Long form: Type P, length 11 Bytes (for example: 19981224235959,1234567)
The long form of the ABAP timestamp is accurate to 7 decimal places more than the short form.
ABAP type P allows simple comparison and assignment of time stamps (even of varying accuracies).
However, general arithmetic with time stamps is not possible. The ABAP processor would
interpret the time stamp as a TYPE P number. Therefore,
you can use the class CL_ABAP_TSTMP for arithmetical operations with time stamps.
Use the GET TIME STAMP FIELD f
statement to place a current timestamp in field f.The
time in the timestamp is always given in Universal Time Coordination
(UTC) time, formerly known as Greenwich Mean Time. This ensures that the timestamp is always uniquely and globally valid.
While the ABAP timestamp is stored internally in UTC time,
the external view is that of the local time zone. The aim is to allow the user to work with time data
in his or her local time.
To convert between internal (UTC) time and local time, use the following
ABAP statements:
UTC
to local time:
,,CONVERT
TIME STAMP ... TIME ZONE ... INTO DATE ... TIME ...
,,WRITE ... TIME ZONE
....
Local time to
UTC:
,,CONVERT
DATE ... TIME ... INTO TIME STAMP ... TIME ZONE ...
After TIME ZONE comes the user's local
time zone. This is available to the ABAP processor in the system field SY-ZONLO.
The details of the difference between the local time zone, all other time zones in the system, and
UTC
time is stored in the tables
TTZZ, TTZR,
TTZD, TTZDF,
and TTZDV. You can maintain the tables using Transaction STZBD.