Application Development 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: 

Time conversion issue

Former Member
0 Kudos

Hi All,

when I am trying to convert EST or PST time to UTC time zone (my final result always want in UTC)

cust_tzone = 'UTC'.


PERFORM convert_time_zone USING cust_tzone t_line_data-poddate t_line_data-podtime.

FORM convert_time_zone USING cust_tzone indate intime.

   CONVERT DATE indate TIME intime

*                DAYLIGHT SAVING TIME 'X'

                 INTO TIME STAMP zztstamp TIME ZONE cust_tzone.

   zzcstamp = zztstamp.

   CONDENSE zzcstamp NO-GAPS.

   indate = zzcstamp(8).

   intime = zzcstamp+8(6).

ENDFORM.    "convert_time_zone


Its not converting because my system timezone also 'UTC'.


which ever time i have given same out i am getting will converting to UTC.


Please help me on same


Best Regards,

Raghava

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Why do you write

cust_tzone = 'UTC'


and not


cust_tzone = 'EST'


if you want to convert EST to an UTC time stamp???


(the time zone passed to TIME ZONE must be available in TTZZ)

7 REPLIES 7

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Why do you write

cust_tzone = 'UTC'


and not


cust_tzone = 'EST'


if you want to convert EST to an UTC time stamp???


(the time zone passed to TIME ZONE must be available in TTZZ)

0 Kudos

i will get date/time in IDOC with tzone EST .

Need to convert always UTC timezone so i have hard code 'UTC' value .

yes UTC timezone available in TTZZ table

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

No.

CONVERT DATE always produces an UTC time stamp.

You must specify the origin time zone! Or how should the statement know that you want convert from EST to UTC???

You are converting from UTC to UTC ...

0 Kudos

Yes your correct ,

i have time already in EST (indate :20160628 intime : 12:12:12)

   CONVERT DATE indate TIME intime

                 INTO TIME STAMP zztstamp TIME ZONE 'UTC'.

its giving same values zztstamp :20160628121212

CONVERT DATE always produces an UTC time stamp.


But i am passing values is EST time.


Best Regards,

Raghava

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

So why don't you write

   CONVERT DATE indate TIME intime

                 INTO TIME STAMP zztstamp TIME ZONE 'EST'.  now?

0 Kudos

Yes let me try now

Former Member
0 Kudos

Hi,

DATA :  timestamp like TZONREF-TSTAMPS,

            time      like sy-uzeit,

            date      like sy-datum.


CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'

  EXPORTING

    i_timestamp       = timestamp

    I_TZONE           = 'PST'

IMPORTING

    E_DATLO           = date

    E_TIMLO           = time.

write 😕 'Date and Time at PST zone is ',date, time.

OR YOU CAN CHECK THIS ALSO

FM CONVERT_INTO_TIMESTAMP or check any FM converttimestamp*.

Thanks.