11-22-2013 12:59 PM
Hi team,
I need to convert the date and time entered in user time zone to UTC. I have written the following code.
CONVERT DATE im_date_range-low TIME l_time_from INTO TIME STAMP l_utc_low_tstmp TIME ZONE l_timezone_utc
For Example my time zone is PST, and I want to convert into UTC. but the above statement is just concatenating the Date and Time.but not converting into time stamp in UTC.
I entered the date and time as follows
Date : 11/22/2013 and Time 00:00:00
I expect a time stamp in UTC as following
20131122070000 , i..e. the time which is 7 hrs ahead. but the output is 20131122000000 which is just concatenating the Date and time.
Can any one let me know the settings to be made.
My user is configured with PST time zone and I want to convert the date and time into UTC.
11-25-2013 6:25 AM
Instead of giving Time zone as UTC, giving the user time zone fixed the issue.
CONVERT DATE l_date TIME l_time_from INTO TIME STAMP l_utc_low_tstmp TIME ZONE sy-zonlo.
11-22-2013 1:14 PM
Hi ,
Regarding the conversion of time between different timezones. In order to achieve this, first we need to convert the time to standard GMT and from GMT to the required timezone.
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 timezone, 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 timezone. The input parameters for this are the timestamp obtained from the above function module and the timezone, to which the time needs to be converted.
The output parameters are the date, time in the required timezone.
Thanks.
11-22-2013 1:22 PM
Thnks Uday,
Could you please let me know if my understanding is correct.
First use the function IB_CONVERT_INTO_TIMESTAMP to convert PST format to GMT. ( Time zone passed is GMT )
Then use the function IB_CONVERT_FROM_TIMESTAMP to convert GMT to UTC. ( Time Zone passed is UTC)
Using the date and time in UTC I need to create a time stamp.
But using the example I given above I am getting a dump.
Regards
Prasanth Kasturi
11-23-2013 2:35 AM
Hi Prasanth,
Use this:
cl_abap_tstmp=>systemtstmp_syst2utc( "timestamp in UTC
EXPORTING
syst_date = sy-datum
syst_time = sy-uzeit
IMPORTING
utc_tstmp = gw_UTCtimestmp ).
Thanks,
Anil
11-25-2013 6:25 AM
Instead of giving Time zone as UTC, giving the user time zone fixed the issue.
CONVERT DATE l_date TIME l_time_from INTO TIME STAMP l_utc_low_tstmp TIME ZONE sy-zonlo.