Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Is there any Function module to convert timestamp into ISO format?

Former Member
0 Kudos
8,790


Hi,

Is there any function module which displays the timestamp in ISO format, when we have timestamp and time zone?

If it is not there then should we split the timestamp and display it in ISO format or is there any other way.

Please let me know.

Thanks,

Swetha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
2,904

Swetha, You could also manually do it like this.

DATA :time_stamp TYPE timestampl,
       ts_char(28).
DATA : l_date(10), "like sy-datum,
        l_time(12), "like sy-uzeit.
        l_mtime(7).
DATA : str TYPE string.
GET TIME STAMP FIELD time_stamp.

ts_char = time_stamp.
SPLIT ts_char AT '.' INTO ts_char l_mtime.

CONVERT TIME STAMP time_stamp TIME ZONE sy-zonlo
   INTO DATE l_date TIME l_time.

WRITE : l_date TO l_date USING EDIT MASK '____-__-__' .
WRITE l_time TO l_time USING EDIT MASK '__:__:__.______'.

CONCATENATE l_date l_time into str separated by space.
CONCATENATE str l_mtime INTO str.

write😕 str.

5 REPLIES 5
Read only

Former Member
0 Kudos
2,904

Hi Swetha,

Could you pls try this Fm - TZ_GLOBAL_TO_LOCAL


Thanks

Tarak

Read only

Former Member
0 Kudos
2,904

Hi Swetha,

Use this statement

CONVERT TIME STAMP lv_utc_timestamp TIME ZONE sy-zonlo
  INTO DATE lv_local_date TIME lv_local_time.

Read only

Former Member
0 Kudos
2,905

Swetha, You could also manually do it like this.

DATA :time_stamp TYPE timestampl,
       ts_char(28).
DATA : l_date(10), "like sy-datum,
        l_time(12), "like sy-uzeit.
        l_mtime(7).
DATA : str TYPE string.
GET TIME STAMP FIELD time_stamp.

ts_char = time_stamp.
SPLIT ts_char AT '.' INTO ts_char l_mtime.

CONVERT TIME STAMP time_stamp TIME ZONE sy-zonlo
   INTO DATE l_date TIME l_time.

WRITE : l_date TO l_date USING EDIT MASK '____-__-__' .
WRITE l_time TO l_time USING EDIT MASK '__:__:__.______'.

CONCATENATE l_date l_time into str separated by space.
CONCATENATE str l_mtime INTO str.

write😕 str.

Read only

0 Kudos
2,904

Thanks Susmitha.I am manually doing it now.

Read only

0 Kudos
2,904

Thanks for the information Susmitha. It helped for me