CONVERT TIME STAMP
CONVERT TIME STAMP time_stamp TIME ZONE tz
INTO [DATE dat]
[TIME tim] [DAYLIGHT SAVING TIME dst].
This statement interprets the content of
time_stamp as a
time stamp, converts it to the local data and the
local time in the time zone specified in
tz, and assigns the result to the variables
tz are functional operand positions.
time_stampmust have the type TIMESTAMP or TIMESTAMPL from ABAP Dictionary, in accordance with the ABAP type p with length 8 or
pwith length 11 with seven decimal places. Depending on the data type, the content is interpreted either as a time stamp in the short form or as a time stamp in the long form. No other data types can be specified. If
time_stampdoes not contain a valid time stamp, the content of
timis not changed, and
sy-subrcis set to 12.
tzmust have the type TZNZONE and contain a time zone from the database table TTZZ.
tzis initial, the time zone is set implicitly to "UTC",
timare given the appropriate values, and
sy-subrcis set to 8.
- If the specified time zone is not found in the database table TTZZ, the content of
timis not changed and
sy-subrcis set to 8.
- If the rule set for the specified time zone is incomplete, an exception that cannot be handled is raised.
The local date in the format of the data type
dis assigned to
datand a variable must be specified to which the return value can be converted.
The local time in the format of the data type
tis assigned to
timand a variable must be specified to which the return value can be converted. If the time stamp in
time_stampis in the long form, the seconds fractions in the decimal places are ignored.
If the time stamp in
time_stampfor the time zone specified in
tzis in summer time, then
dstis given the value "X". Otherwise it is given the value " ". A variable of the type
cwith length 1 must be specified
When time stamps are converted to reflect the conversion from the Julian calendar to the Gregorian calendar and the non-existence of the days between 19/5/1582 and 10/14/1582, this returns the same results as the conversion for the days from 10/15/1582 to 10/24/1582 (which do exist).
|0||Time stamp was converted into the local time of the specified time zone and assigned to the target fields.|
|4||Time stamp was assigned to the target fields without conversion into the local time.|
|8||Time stamp could not be converted, because the specified time zone is not in the database table TTZZ.|
|12||Time stamp could not be converted since
A current UTC time stamp can be created using the
GET TIME STAMPstatement.
The current user time zone can be found in the system field
It is now possible to use the return value for the summer time in
dstto differentiate between duplicate local time specifications that occur when UTC time stamps are converted into local time during the double hour in the changeover between summer and winter time.
For the time zone "BRAZIL" in database table TTZZ, a shift of -3 hours from the UTC reference time is entered in database table TTZR. The end of the summer time is defined in database table TTZDV as the second Sunday in March at 02:00, which in the year 2003 is March 9. With these settings in the rules, the two conversions below both result in the same local time of "01:30:00". The first conversion shows that the time is still in the summer time.
DATA: time_stamp TYPE timestamp, dat TYPE d, tim TYPE t, tz TYPE ttzz-tzone, dst TYPE c LENGTH 1. tz = 'BRAZIL'. time_stamp = 20030309033000. CONVERT TIME STAMP time_stamp TIME ZONE tz INTO DATE dat TIME tim DAYLIGHT SAVING TIME dst. WRITE: /(10) dat, (8) tim, dst. time_stamp = 20030309043000. CONVERT TIME STAMP time_stamp TIME ZONE tz INTO DATE dat TIME tim DAYLIGHT SAVING TIME dst. WRITE: /(10) dat, (8) tim, dst.
Cause: Inconsistent control tables for the conversion.