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

user time zone

Former Member
0 Likes
664

Hi

In my down load prg I am displaying the time by using sy-uzeit. but now what I required is I want to display time in user selected time zone. How I have to do.

thanks,

suma.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
638

See the code below

DATA: v_timestamp TYPE timestamp,
      v_tzone     TYPE timezone,
      v_date      LIKE sy-datum,
      v_time      LIKE sy-uzeit.

v_tzone = 'INDIA'.

GET TIME STAMP FIELD v_timestamp.

CONVERT TIME STAMP v_timestamp TIME ZONE v_tzone INTO DATE v_date
                                                      TIME v_time.

WRITE:/ v_date,
        v_time.

4 REPLIES 4
Read only

ferry_lianto
Active Contributor
0 Likes
638

Hi,

Instead of using the fields SY-DATUM and SY-UZEIT, use the fields SY-DATLO and SY-TIMLO to get local time from the specified time zone for the user.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
638

I am getting 5hours differance even I used EST time zone for system and user.

Read only

Former Member
0 Likes
639

See the code below

DATA: v_timestamp TYPE timestamp,
      v_tzone     TYPE timezone,
      v_date      LIKE sy-datum,
      v_time      LIKE sy-uzeit.

v_tzone = 'INDIA'.

GET TIME STAMP FIELD v_timestamp.

CONVERT TIME STAMP v_timestamp TIME ZONE v_tzone INTO DATE v_date
                                                      TIME v_time.

WRITE:/ v_date,
        v_time.

Read only

ferry_lianto
Active Contributor
0 Likes
638

Hi Suma,

Please try this FM TZ_SYSTEM_TO_LOCAL to convert system to local.

Regards,

Ferry Lianto