‎2008 May 27 3:56 AM
Hi,
I need to convert the following time stamp into date and time. could any one help me how to do this?
Input format:
2008-05-19T01:00:00Z
Convert statement wont work as it has characters in it.
At present i have converted by using split statment. is there any other way of doing it ?
Regards,
Niyaz
‎2008 May 27 4:26 AM
Hi,
The FM ABI_TIMESTAMP_CONVERT_FROM converts timestamp into date and time.
Regards,
Sriram
‎2008 May 27 4:21 AM
Hi Niyaz,
try this...
DATA:
lv_timestamp TYPE string VALUE '2008-05-19T01:00:00Z',
lv_datum TYPE datum,
lv_time TYPE uzeit.
lv_datum(4) = lv_timestamp(4).
lv_datum+4(2) = lv_timestamp+5(2).
lv_datum+6(2) = lv_timestamp+8(2).
lv_time(2) = lv_timestamp+11(2).
lv_time+2(2) = lv_timestamp+14(2).
lv_time+4(2) = lv_timestamp+17(2).
Cheers
Graham Robbo
‎2008 May 27 5:07 AM
Hi there,
it just occured to me that this would work as well.
DATA:
lv_timestamp TYPE string VALUE '2008-05-19T01:00:00Z',
lv_datum TYPE datum,
lv_time TYPE uzeit,
lv_tstamp TYPE tzntstmps.
REPLACE ALL OCCURRENCES OF '-' IN lv_timestamp WITH ''.
REPLACE ALL OCCURRENCES OF 'T' IN lv_timestamp WITH ''.
REPLACE ALL OCCURRENCES OF ':' IN lv_timestamp WITH ''.
REPLACE ALL OCCURRENCES OF 'Z' IN lv_timestamp WITH ''.
MOVE lv_timestamp TO lv_tstamp.
CONVERT TIME STAMP lv_tstamp TIME ZONE 'GMT ' "Use sy-zonlo to convert to local timezone
INTO DATE lv_datum TIME lv_time.
Cheers
Graham Robbo
‎2008 May 27 4:26 AM
Hi,
The FM ABI_TIMESTAMP_CONVERT_FROM converts timestamp into date and time.
Regards,
Sriram
‎2008 May 27 5:00 AM
Hi,
As in above post u use the FM to get your output. Check the below code:
data : a type string,
time_stamp type TZONREF-TSTAMPS,
date type SY-DATLO,
time type SY-TIMLO.
a = '2008-05-19T01:00:00Z'.
REPLACE ALL occurrences of '-' in a with space.
REPLACE ALL occurrences of ':' in a with space.
REPLACE ALL occurrences of 'T' in a with space.
REPLACE ALL occurrences of 'Z' in a with space.
time_stamp = a.
CALL FUNCTION 'ABI_TIMESTAMP_CONVERT_FROM'
EXPORTING
iv_timestamp = time_stamp
IMPORTING
O_DATE = date
O_TIME = time
EXCEPTIONS
CONVERSION_ERROR = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write : date, time.Regards,
Raghu
‎2008 May 27 5:06 AM