cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How do ı find other country's time?

gsekercan
Explorer
0 Kudos
1,186

Hello,

I need to find out what time it is in another country city. How can I follow a path through functions in SE37 tcode.

For example my time and date is 23:22, 04.10.2020 in GMT + 3 time zone.

I want to learn Germany's time in GMT + 2 time zone.

Best regards.

Good works.

Accepted Solutions (1)

Accepted Solutions (1)

Private_Member_467521
Active Contributor
0 Kudos

Hi gsekercan,

This is regarding the conversion of time between different time zones. In order to achieve this, first we need to convert the time to standard GMT and from GMT to the required time zone.

The following function modules does the same.

The function module IB_CONVERT_INTO_TIMESTAMP is used to convert the time to the GMT. The input parameters are DATE, TIME and the TIMEZONE(user's time zone, default value SY-ZONLO). The output parameter is the timestamp in GMT.

The function module IB_CONVERT_FROM_TIMESTAMP is used to get the time in required time zone. The input parameters for this are the timestamp obtained from the above function module and the time zone, to which the time needs to be converted.

The output parameters are the date, time in the required time zone.

Code

REPORT ZTIMEZONES .

*****************************************************
* This program is used to convert the times between *
* different time zones. This program deals with the *
* conversion of time from INDIA time zone to the PST *
* time zone *
*****************************************************

* Declaring the work variables.......................
DATA :
timestamp like TZONREF-TSTAMPS,
time like sy-uzeit,
date like sy-datum.

* The following function module is used to convert the
* time and date into GMT timestamp

CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = sy-datum
i_timlo = sy-uzeit
I_TZONE = 'INDIA'
IMPORTING
E_TIMESTAMP = timestamp.

* The following function module is used to convert the
* above obtained timestamp to PST time zone date and time.

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.

Cheers,

Luis

Answers (1)

Answers (1)

Abinathsiva
Active Contributor
0 Kudos

Hi,

Use this FM to convert present GMT to UTC CL_KF_HELPER=>TIMESTAMP_LOCAL_ZONE_2_UTC

and convert UTC to required GMT using CL_KF_HELPER=>TIMESTAMP_UTC_2_LOCAL_ZONE

You can look at zones in table TTZ5. For IN it is 'INDIA' .