ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Date and Time Processing → Time Stamps
Time Stamp Field with Time Stamp Type
ABAP contains the built-in ABAP type utclong
for time stamps with a precision of 100 nanoseconds. A data object of this time stamp type is a time stamp field. Each valid value of a time stamp field is a
UTC time stamp and represents a unique time in
UTC reference time. In accordance with POSIX,
leap seconds are not supported, which means that each day has exactly 86400 seconds.
Other versions:
7.31 | 7.40 | 7.54
Access to Time Stamp Fields
Time stamp fields can be used in suitable operand positions and special
assignment and
comparison rules apply. Time stamp fields can only be converted to
text fields of the type c
and
text strings of the type string
.
The following functions, statements, and classes are designed specifically for time stamp fields:
A time stamp field must have valid content each time it is used. If a time stamp field containing an invalid time stamp or the initial value is used, a handleable exception of the class CX_SY_CONVERSION_NO_DATE_TIME is raised. The content remains unchecked only in castings or in assignments between time stamp fields.
Note
For time stamp fields, conversion errors raise an exception of the class CX_SY_CONVERSION_NOT_SUPPORTED.
Initial Value of a Time Stamp Field
The initial value of a time stamp is not a real time stamp value. This means that it represents an empty value, handled as follows, and not a time stamp:
- In comparisons and sorts based on comparisons, an initial time stamp field is less than every real time stamp.
- An initial time stamp field passed as an argument is handled like the least real time stamp in the time stamp functions.
- In the conversion statements, initial time stamp fields generate initial results.
- During the conversion to character-like fields, an initial time stamp field fills a text field with spaces or generates an empty text string.
- During formatting as a character string using
string templates or
with the statement
WRITE TO
, an initial time stamp field generates a character string consisting of spaces.
Internal Representation of a Time Stamp in a Time Stamp Field
The internal representation of the valid values of a
time stamp field with the
time stamp type
utclong
are uninterrupted sequences of integers (starting from 0), where 0 represents the initial value and each number greater than 0 is assigned a real time stamp.
- The minimum internal value is 1 and is the same as the time stamp "0001-01-01T00:00:00.0000000".
- The maximum internal value is 3,155,380,704,000,000,000 and is the same as the time stamp "9999-12-31T23:59:59.9999999”.
- The time interval between time stamps represented by two adjacent integers is 100 ns. Each integer between the minimum and maximum value represents a time stamp of 100 ns multiplied by the value of the number after "0001-01-01T00:00:00.0000000".
- Time stamp fields must meet an alignment requirement. Their memory address must be divisible by eight.
Note
Due to the switch from the Julian calendar to the Gregorian calendar, the time stamps "1582-10-04 23:59:59.9999999" and "1582-10-15T00:00:00.0000000" are directly adjacent. Internally, they are represented using two consecutive integers.