Application Development 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: 

Regarding time stamp

Former Member
0 Kudos

Hi ABAPers,

I am working in PS module.In cprojects the date

field displays like 13.02.2008 but at database level it sore it

as 12.02.2008 18.30.00.but i need the data as 13.02.2008

can any one tell me abt this why its happening and also could

u plz give me the solution for this.

thanks&regards,

kishore.

1 ACCEPTED SOLUTION

former_member69765
Contributor
0 Kudos

Hi Kishore,

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

-- So do I deserve some points here ?

7 REPLIES 7

Former Member
0 Kudos

Hi Kishore,

System might be taking the local date and time while updation.

0 Kudos

Solved

Former Member
0 Kudos

Hi,

It seems, you are comparing Project creation date and Project start date. Plz check the relevant fields properly.

Regards,

CS

0 Kudos

Hi ,

i already checked i am choosing role satrt date enddate.

regards,

kishore

Former Member
0 Kudos

yes.. good chance using local time.


  GET TIME.
  loc_date = sy-datlo.
  loc_time = sy-timlo.

the 2 loc fields will not contain date and time of where the user is.

Using sy-datum and sy-UZEIT will give the server date and time.

Former Member
0 Kudos

Hai.

how r u updating thedate value in to the database? r u using a function module ?if yes, make sure that the function module does not change the value.

regards.

sowjanya.b

former_member69765
Contributor
0 Kudos

Hi Kishore,

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

-- So do I deserve some points here ?