ABAP - Keyword Documentation →  ABAP - Programming Language →  Built-In Types, Data Objects, Functions, and Constructors →  Built-In Data Types →  Built-In ABAP Types → 
Mail Feedback

Built-In Date Types, Time Types, and Time Stamp Types

The data objects of the date types, time types, and time stamp types are used to store calendar dates, times, and time stamps.

Attributes

Type Length Standard Length Meaning Data Object
d 8 characters   Date type Date field
t 6 characters   Time type Time field
utclong 8 byte   Time stamp type Time stamp field

Value Ranges and Initial Values

Type Value Range Initial Value
d Any eight Unicode characters that can be encoded in UCS-2; valid values are only digits that are valid as dates in accordance with the calendar rules in the format yyyymmdd: yyyy (year): 0001 to 9999, mm (month): 01 to 12, dd (day): 01 to 31 00000000
t Any six Unicode characters that can be encoded in UCS-2; valid values are only digits that are valid as times in accordance with the 24-hour clock range in the format hhmmss. hh (hours): 00 to 23, mm (minutes): 00 to 59, ss (seconds): 00 to 59. 000000
utclong Internal 8-byte integer representation of a UTC time stamp exact to 100 nanoseconds, in ISO-8601 notation between 0001-01-01T00:00:00.0000000 and 9999-12-31T23:59:59.9999999. There are 3,155,380,704,000,000,000 real values and one special initial value. 0

Hints

Example

Declaration of date fields and time fields of the built-in ABAP types d and t and examples for their use. The declarations are made with the statement DATA and using the declaration operator DATA.

DATA: tomorrow  TYPE d,
      next_hour TYPE t.

FINAL(today) = cl_demo_date_time=>get_user_date( ).
FINAL(now)   = cl_demo_date_time=>get_user_time( ).

tomorrow  = today + 1.
next_hour = ( now + 3600 ) / 3600 * 3600.

Example

Creation of a time stamp of the type utclong with the built-in function utclong_current and its conversion to date and time fields.

FINAL(ts) = utclong_current( ).

FINAL(time_zone) = cl_demo_date_time=>get_user_time_zone( ).
CONVERT UTCLONG ts
        INTO DATE FINAL(dat) TIME FINAL(tim)
        TIME ZONE time_zone.

cl_demo_output=>display(
  |{ ts }\n| &&
  |{ dat }\n| &&
  |{ tim }|  ).