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

convert time

Former Member
0 Likes
3,862

hi ,

Currently i am using sy-uzeit system variable for system time bur it is showing paris time i want indian time please help me for that,

and in our application server time is paris time only .

Thanks in advance.....

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,659

Hi,

You can search in forums first

I think you can use system variable SY-TIMLO for local time.

regards,

Nazeer

10 REPLIES 10
Read only

SureshRa
Active Participant
0 Likes
2,659

Hi Ankita,

Use GET TIME STAMP FIELD f statement to get UTC (Greenwich Mean Time)

Subsequently use statement CONVERT TIME STAMP tst TIME ZONE tz INTO DATE d TIME t to get the desired zone time.

Refer ABAPDOCU T-Code for these keyword help.

Cheers,

Suresh

Read only

Former Member
0 Likes
2,659

hi ,

thanks for rply...

can you make it more clear please....

Read only

SureshRa
Active Participant
0 Likes
2,659

Hi Ankita,

GET TIME STAMP FIELD f

Returns the time stamp in field f consisting of current date and time. The target field f contains the global reference time UTC (Universal Time Coordination).

Then using this field f you need to get Indian Time using statement

CONVERT TIME STAMP f TIME ZONE tz INTO DATE d TIME t

Converts between UTC time stamp "f" to date "d" or time "t" for time zone "tz"

The time stamp "f" always refers to UTC time (which you got from GET TIME STAMP FIELD f)

Refer values for timezone "tz" in table TTZZ (field TZONE)

Hope this is clear. Refer ABAPDOCU Transaction code and see the keyword documentation of the above two statements

Cheers

Suresh

Read only

Former Member
0 Likes
2,660

Hi,

You can search in forums first

I think you can use system variable SY-TIMLO for local time.

regards,

Nazeer

Read only

0 Likes
2,659

I already checked SY-TIMLO it is also showing paris time only and i checked in forum also...

Read only

0 Likes
2,659

Hi Ankita,


From the link: http://searchsap.techtarget.com/tip/0,289483,sid21_gci970550,00.html
Here is how to handle time zones in ABAP when several time zones are involved in a project. This is quit helpful when processes are spread around several regions and/or countries.

Code

The time zone should be specified for each user with SU01. 
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. 

If you need to convert date and time into a local time zone, the function TZ_SYSTEM_TO_LOCAL should be used. 


From the link: http://searchsap.techtarget.com/tip/0,289483,sid21_gci826364,00.html

This is 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 ... 

Hope this helps you.

Regards,

Swarna Munukoti

Read only

0 Likes
2,659

Hello,

see the code below

DATA: time_stamp TYPE timestamp,

dat TYPE d,

tim TYPE t,

tz TYPE ttzz-tzone,

dst(1) TYPE c.

tz = 'INDIA'.

GET TIME STAMP FIELD time_stamp.

SKIP.SKIP.

write time_stamp.

SKIP.SKIP.

CONVERT TIME STAMP time_stamp TIME ZONE tz

INTO DATE dat TIME tim." DAYLIGHT SAVING TIME dst.

WRITE: /(8) tim.

copy paste this code and check ..

regards,

Nazeer

Read only

Former Member
0 Likes
2,659

Hi,

Time in Paris = GMT + 1 hour and Time in India = GMT + 5.5 hours ( 5 hours 30 minutes )

Hence in your case,

Time in India = Time in Paris + 4.5 hours

Regards,

Bhavesh.

Read only

Former Member
0 Likes
2,659

Hi ankita,

Refer this code




CALL FUNCTION 'RKE_TIMESTAMP_CONVERT_INPUT'
    EXPORTING
      i_date       = sy-datum
      i_dayst      = sy-dayst
      i_time       = sy-uzeit
      i_tzone      = sy-tzone
    IMPORTING
      e_timestmp   = ch_timestmp
    EXCEPTIONS
      date_invalid = 1
      OTHERS       = 2.
  IF sy-subrc <> 0.
    MESSAGE e129(zms) WITH sy-datum sy-uzeit.
  ENDIF.

Edited by: pravin s. on Dec 22, 2009 6:05 AM

Read only

Former Member
0 Likes
2,659

please follow the link: