Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Date and Time Processing →  Time Stamps →  Time Stamp Field with Time Stamp Type 

System Class for Time Stamp Fields

The Class Library contains the following system class for handling time stamps in time stamp fields:

  • CL_ABAP_UTCLONG

This class provides the following methods:

  • DIFF for calculating time differences.
  • READ for reading a time stamp from a string.

The attributes MIN and MAX contain the minimum and maximum values of the time stamp type utclong.

Other versions: 7.31 | 7.40 | 7.54


Note

An initial time stamp passed to the method DIFF is handled here like the lowest possible value of a time stamp.


Example

Compares the method DIFF with the built-in function utclong_diff.

DATA(ts_low)  = utclong_current( ). 
DATA(ts_high) = utclong_add( val     = ts_low 
                             seconds = 100000 ). 

DATA(diff) = utclong_diff( high = ts_high 
                          low  = ts_low ). 

cl_abap_utclong=>diff( EXPORTING high     = ts_high 
                               low      = ts_low 
                       IMPORTING days    = DATA(days) 
                                hours   = DATA(hours) 
                                minutes = DATA(minutes) 
                                seconds = DATA(seconds) ). 

ASSERT diff = 100000. 
ASSERT diff = 86400 * days + 3600 * hours + 60 * minutes + seconds.

Executable Example

Read Time Stamp from String

Continue

Read Time Stamp from String