SAP CONVERT UTC ABEXA



Get Example source ABAP code based on a different SAP table
  


VX_EXA_ONLY

Convert Time Stamp in Time Stamp Field
This example demonstrates the statements CONVERT INTO UTCLONG and CONVERT UTCLONG.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
The program is given a date, a time, and a time zone and converts these specifications into a time stamp. The program can also include daylight saving time in its calculations. The resulting time stamp is then converted to the local date and local time of another time zone. The following table shows some possible combinations of input and output, where spc stands for a space and - for no input or output. date1time1tz1dst1tstz2 date2time2dst2cx_...
16.07.201009:10:00CET- 2010-07-16T07:10:00CET16.07.201009:10:00 X-
16.07.201009:10:00CETX 2010-07-16T07:10:00CET16.07.201009:10:00 X-
16.07.201009:10:00CETspc- CET- --X
16.12.201009:10:00CETspc 2010-12-16T08:10:00CET16.12.201009:10:00 --
16.12.201009:10:00CETX- CET---X
16.12.201009:10:00AUSTAS- 2010-12-15T22:10:00AUSTAS16.12.2010 09:10:00 X-
01.01.000101:00:00UTC+4- - UTC+4---X
31.12.999923:59:59UTC-4- 9999-12-31T23:59:59UTC31.12.999923:59:59 --
The third and fifth lines demonstrate that invalid specifications for daylight saving time data raise an exception. The last two lines show how values behave at the limits of the value range. Line 7 produces an invalid time stamp and hence raises an exception. The maximum value in line 8, however, does not calculate a time shift and no exception is raised. If specified, 23:59:58 would raise an exception.