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 system time into User local time.

Former Member
0 Likes
2,821

Hi,

How to convert System time into User Local time.

Are there any FMs available.

Regards,

Kiran

Hi,

How to convert System time into User Local time.

Are there any FMs available.

Regards,

Kiran

4 REPLIES 4
Read only

Former Member
0 Likes
1,304

Just use the system variable SY-TIMLO...

Regards

Read only

Former Member
0 Likes
1,304

Check the FM

RKE_TIMESTAMP_CONVERT_OUTPUT

Hope it helps

Read only

Former Member
0 Likes
1,304

hi,

There is just one simple funda behind the Date and time logic in SAP.

-> It is absolutely useless to store Date and time directly in DB. Why ?

Because 00:00 a.m in London could mean 05:30 in India !! So If I (in India) store a Date 1st Feb 2008 , 10:00 a.m .. This time for a person in London could be invalid.. because he is behind your time zone..

So the solution is to store the date/times in Timestamps format. Taking the above example.. 1st Feb 2008, 10:00 a.m (in India) will be stored as 20080201043000.

This time if seen in German Time zone will look as : 1st Feb 2008, 05:30 a.m.

Simple right

-> In India we store date as DD.MM.YYYY while in other countries they store it as MM.DD.YYYY.

The separator could be . or - or / .

The date format is user dependent. I might prefer to store it as DD.MM.YYYY and you might want to store it as MM-DD-YYYY.

System does not bother what your format is. It always stores in YYYYMMDD (8 Char)

On screens if you want to display Date then it must always be shown in that users format who is seeing it. How to get this done ?

DATA : lv_date(10) type c.

write sy-datum into lv_date.

So in LV_DATE variable the date will be stores in the users format.

Simple right

There are function modules that do the same. But normally we should avoid use of FM to make code simpler, short and easy... no complications at all ..

You can use system variables sy-datlo (Local Date for Current User) and sy-timlo ( Local Time of Current User ).

You can also use GET TIME statement.

reward if useful,

preet

Read only

Former Member
0 Likes
1,304

thank you