03-24-2008 11:48 AM
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®ards,
kishore.
04-19-2008 5:33 PM
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 ?
03-24-2008 11:52 AM
Hi Kishore,
System might be taking the local date and time while updation.
09-15-2011 11:01 AM
03-24-2008 11:58 AM
Hi,
It seems, you are comparing Project creation date and Project start date. Plz check the relevant fields properly.
Regards,
CS
03-24-2008 12:03 PM
Hi ,
i already checked i am choosing role satrt date enddate.
regards,
kishore
03-24-2008 11:58 AM
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.
03-24-2008 12:03 PM
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
04-19-2008 5:33 PM
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 ?