‎2007 Mar 22 5:06 PM
Hi,
I am planning to use the Function Module TZ_LOCAL_TO_SYSTEM in my program however, I found out that it was already marked as obsolete. Would somebody know which FM replaced this ? This function module converts a timezone specific date/time to the system time.
Thanks
‎2007 Mar 22 5:07 PM
‎2007 Mar 22 5:08 PM
Hi,
Check this example for converting the time according to the time zone..
TYPE-POOLS: tstr.
DATA :
timestamp LIKE tzonref-tstamps,
time LIKE sy-uzeit,
date LIKE sy-datum.
DATA: timezone TYPE tstr_tzone.
PARAMETERS: p_land1 TYPE land1.
Get Timezone for the country.
CALL FUNCTION 'BORRS_LOCATION_TIMEZONE'
EXPORTING
if_country = p_land1
IMPORTING
ef_timezone = timezone
EXCEPTIONS
no_timezone_found = 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.
Get the timestamp.
CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
EXPORTING
i_datlo = sy-datum
i_timlo = sy-uzeit
i_tzone = sy-zonlo
IMPORTING
e_timestamp = timestamp.
Convert timestamp.
CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
EXPORTING
i_timestamp = timestamp
i_tzone = timezone
IMPORTING
e_datlo = date
e_timlo = time.
WRITE 😕 'Date and Time zone for time zone', timezone, ' is ',
date, time.
Thanks,
Naren
‎2007 Mar 22 5:22 PM
Concatenate date and time into a timestamp variable and use the following syntax.
DATA: ic_timestamp(15) TYPE c,
iv_timestamp LIKE tzonref-tstamps,
ev_date LIKE sy-datum,
ev_time LIKE sy-uzeit,
v_zone LIKE sy-zonlo.
CONCATENATE sy-datum
sy-uzeit
INTO ic_timestamp.
iv_timestamp = ic_timestamp.
v_zone = 'PST'.
CONVERT TIME STAMP iv_timestamp
TIME ZONE v_zone
INTO DATE ev_date
TIME ev_time.
WRITE:/ ev_date, ev_time.