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

Function required to convert local time to UTC

Former Member
0 Likes
5,856

Hi,

I have a problem where I have to convert local time into UTC which I need to send to another system, I need to be able to send the UTC offset at the end eg.

internal timestamp = 20090312033000

output timestamp with UTC offset 2009-03-12T0333000+11

Thanks,

Steve.

Hi,

I have a problem where I have to convert local time into UTC which I need to send to another system, I need to be able to send the UTC offset at the end eg.

internal timestamp = 20090312033000

output timestamp with UTC offset 2009-03-12T0333000+11

Thanks,

Steve.

10 REPLIES 10
Read only

Former Member
0 Likes
2,199

hi:

have a look

[link|http://help.sap.com/abapdocu/en/ABAPCONVERT_TIME-STAMP.htm]

Regards

Shashi

Read only

former_member585060
Active Contributor
0 Likes
2,199

Hi,

Try this FM ISU_DATE_TIME_CONVERT_TIMEZONE

Regards

Bala Krishna

Read only

Former Member
0 Likes
2,199

Use FM RKE_TIMESTAMP_CONVERT_INPUT

Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
2,199

Hi,

pls see the following statement:

DATA: l_timestmp1 TYPE comt_changed_at_usr,

s_date TYPE sy-datum.

CONVERT DATE s_date TIME '000000' INTO TIME STAMP l_timestmp1 TIME

ZONE sy-zonlo.

Keerthi.

Read only

former_member242255
Active Contributor
0 Likes
2,199

'IB_CONVERT_INTO_TIMESTAMP'

Read only

Former Member
0 Likes
2,199

Hi,

Use this FM 'ISU_DATE_TIME_CONVERT_TIMEZONE'

Regards,

Jyothi CH.

Read only

Former Member
0 Likes
2,199

None of the above answers give me the offset they just convert into timestamp, I need the offset.

Read only

Former Member
0 Likes
2,199

Hi,

Try these FM's

/AIN/DM_CONVERT_LOCAL_TO_UTC - Conversion from Local to UTC Timestamp

Regards,

Jyothi CH.

Read only

Former Member
0 Likes
2,199

Hi, did you find the way to convert local time to UTC with offset? cause I'm facing the same problem... thanks!

Read only

0 Likes
2,199

Hi, use FM TZON_GET_OFFSET

IF_TIMEZONE       ->  sy-zonlo

IF_LOCAL_DATE  -> sy-datum

IF_LOCAL_TIME   -> sy-uzeit

then use exporting parameters:

EF_UTCDIFF    -> 03:00:00

EF_UTCSIGN   -> -

in my case.

concatenate the variables to get the format required:

CONCATENATE sy-datum(4) '-' sy-datum+4(2) '-' sy-datum+6(2)
              'T' sy-uzeit(2) ':' sy-uzeit+2(2) ':' sy-uzeit+4(2) EF_UTCSIGN EF_UTCDIFF
         INTO vl_utc_date_time.

For me, it was required to use de following format:

"YYYY-MM-DDThh:mm:ss±of:om" where:

 

YYYY indicates the year

MM indicates the month

DD indicates the day

T indicates the start of the required time section

hh indicates the hour

mm indicates the minute

ss indicates the second

± indicate if the offset is positive or negative

of indicate the offset in hour respect the UTC time

om indicate the offset in minute respect the UTC time

Hope it helps!