Convert system time into User local time.

Hi,
How to convert System time into User Local time.
Are there any FMs available.
Regards,
Kiran

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

Similar Messages

  • Need function module to convert system time to local time

    Hi Experts,
    Need function module to convert system time to local time.
    i.e country specific that to in HH:MM format.
    Thanks in advance.

    Dear Prince,
    Kindly check the following link which contains the list of function modules for date and time conversion.
    [http://www.sap-img.com/abap/date-month-pop-related-function-modules.htm]
    Regards

  • Convert the date into user default date formate

    I am wrinting a bdc and i want to convert the date into user default date farmate ..please suggust the functiom module should i use...

    actually by using dats or d type you can get the user specific date itself.
    but if u have different dates format that need to be converted to the user specific date then you can follow below procedure
    1. retrieve the user format from usr01
        SELECT SINGLE datfm
          INTO w_datfm
          FROM usr01
         WHERE bname EQ sy-uname.
    pass w_datfm to the below FM (4th import parameter)
    2. create Z - FM and retrieve the user secific date
    FUNCTION ZFXX_USER_SPECIFIC_DATE.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(IW_DAY) TYPE  CHAR2
    *"     VALUE(IW_MONTH) TYPE  CHAR2
    *"     VALUE(IW_YEAR) TYPE  CHAR4
    *"     VALUE(IW_DATFM) TYPE  USR01-DATFM
    *"  EXPORTING
    *"     VALUE(EW_USER_DATE) TYPE  CHAR0008
    *1  DD.MM.YYYY
    *2  MM/DD/YYYY
    *3  MM-DD-YYYY
    *4  YYYY.MM.DD
    *5  YYYY/MM/DD
    *6  YYYY-MM-DD
    CASE iw_datfm.
      when '1'.
        concatenate iw_day iw_month iw_year
               into ew_user_date.
      when '2'.
        concatenate iw_month iw_day iw_year
               into ew_user_date.
      when '3'.
        concatenate iw_month iw_day iw_year
               into ew_user_date.
      when '4'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when '5'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when '6'.
        concatenate iw_year iw_month iw_day
               into ew_user_date.
      when others.
        clear ew_user_date.
    endcase.
    ENDFUNCTION.

  • How to convert system Date into DD-MMM-YYYY Format

    hi friends,
    please help me How to convert system Date into DD-MMM-YYYY Format.
    Regards
    Yogesh

    HI..
    data: w_dt(11) type c,
             w_month(2),
             w_mon(3).
    w_month = p_date+4(2). **p_date = given date**
    case w_month.
    when '01'.
    w_mon = 'Jan'.
    when '02'.
    w_mon = 'Feb'.
    when '03'.
    w_mon = 'Mar'.
    when '04'.
    w_mon = 'Apr'.
    when '05'.
    w_mon = 'May'.
    when '06'.
    w_mon = 'Jun'.
    when '07'.
    w_mon = 'Jul'.
    when '08'.
    w_mon = 'Aug'.
    when '09'.
    w_mon = 'Sep'.
    when '10'.
    w_mon = 'Oct'.
    when '11'.
    w_mon = 'Nov'.
    when '12'.
    w_mon = 'Dec'.
    endcase.
    Now...
      concatenate p_date6(2)  '-'  w_mon  '-'   p_date0(4)  into w_dt.
    write w_dt.

  • Converting System Time Stamp to Unix Time Stamp

    Hi All,
      I have a requirement to Convert System Date to Unix Date format.Can any one let me know how to convert system date to Unix Date format. Like function module or any other method.
    Regards
    Anil Kumar K

    Hi,
    I dont know if is this what you want:
    http://javascript.internet.com/math-related/unix-date-time-converter.html
    Hope it helps!

  • Convert system date into mm-dd-yyyy format

    Hi everyone, I am developing an web application in jsp.In my application when a client enters his information like name,email etc, they are copied into the database.What i need now is at the same time the system date also has to enter into the database in the format mm-dd-yyyy.My application doesn't ask the user to enter the particular date.So immediately after the client clicks the save button along with the information he saved the system date also has to enter into his particular database. Can anyone help me how to program this or give an idea regarding the approach to be followed. Any sample code is highly appreciated.Thanks in advance,

    well, your application collects user entered info at some place (either in a jsp or a servlet or a handler). At this point you have to generate the sysdate in the specified format.
    For example, if its a servlet that collects the user info,
    public void doGet(.........){
       //collect all request parameters
       //code from previous post to generate date in specific format
       //call method to insert all data
    }You will have to import the library classes as shown below in your program.
    import java.util.Calendar;
    import java.util.Date;
    import java.text.SimpleDateFormat;cheers,
    ram.
    PS: Also when your sql statement should use some kind of functions to convert the String to a date value for insertion.
    For example, in Oracle, you would do this,
    insert into test values(to_date('08-24-2005','mm-dd-yyyy'));Here test is a table with one date column.
    The to_date() function converts the string, which is the first argument, to a date and conversion pattern is the second argument.
    Unfortunately I cant help you with this because Iam not so familiar with mysql.
    cheers,
    ram.

  • Is PGI date beased on system date or user profile time zone date?

    Hi All,
    When doing PGI what date system will take as Actual good issue date ? whether the System Date or User local Time zone date which maintained in User profile. If you have any idea on this please share.
    Regards,
    Lakshmikanth

    Hi,
    You need to check with the basis team for settings this to your local time.
    You can also check the field Personal time zone of the user in t.code SU01. I am not sure this will update the timings in the database when the user performs some action.
    Regards

  • Converting Delivery Creation Date/Time into the Local Date/Time

    Hi
    I have two fields like 'Delivery Creation Date' and 'Delivery Creation Time' in ECC system . My user wants the Delivery Creation Date / Delivery Creation Time in Local time of Plants .
    For example :
    Delivery    Plant       DelivCreationDate       DelivCreationTime   DelivCreationDate(Local)   DelivCreationTime(Local)
    312456          1650               11/2/2007                     4:30                          11/2/2007                          3:30
    Here the Plant 1650 is in Mexico . The above delivery is created in Canada in ECC system according to the candain time .
    But user wants to convert the Candain Delivery Creation Date and Time into the Local Date/Time of specific plant .
    So we need to convert the  Candain Delivery Creation Date and Time into Mexico timings .
    How can it is possible this one and user wants to automate this process .
    Please let me know
    Mubeen

    DATA :
    timestamp like TZONREF-TSTAMPS,
    time like sy-uzeit,
    date like sy-datum.
    The following function module is used to convert the
    time and date into GMT timestamp
    CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
    EXPORTING
    i_datlo = <source_fields>-delivery_date
    i_timlo = <source_fields>-delivery_time
    I_TZONE = CAD'
    IMPORTING
    E_TIMESTAMP = timestamp.
    The following function module is used to convert the
    above obtained timestamp to MEX  timezone date and time.
    CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
    EXPORTING
    i_timestamp = timestamp
    I_TZONE = MEX
    IMPORTING
    E_DATLO = date
    E_TIMLO = time.
    CAD and MEX are variables i have used...
    the challenge is to find the canadian and mexican time zone....CAD and MEX.
    which you can get by performing a lookup in table T001W and passing country as parameter.

  • System Time and Local Time

    Hi all,
    Our system are config to have a different time zone with the system time. Just wondering what type of fields will take the local time and which type will take system time. We found that dates like document date/time will take local time but created by date/time will take system time. Why is this so?
    We know that for job scheduling will run at system time. Is there a way to let the system know to run at the local time? Users find it very troublesome to adjust the timing.
    Rewards will be given to useful answers. Many thanks.
    Regards,
    Janet

    Hi,
    I found this info in one of the SAP sites i found this may be useful to you.
    The easiest way to prevent any time zone problems is to run everything with UTC (formerly GMT - Greenwich Mean Time). But while it’s a good idea for servers, end users will most likely complain about being confused (my family doesn’t - my home systems are on UTC to prevent the hassles with summer/winter time). And if you implement SAP using local time on the server, while your users are in different time zones, things can get slightly complicated. Just try searching in OSS with search term “sy-timlo”.
    The main problem is that some fields in SAP are stored as server local time (and date), while others use user’s local time. In general, as SAP explains in many OSS notes, any date/time that is written by the system is server local time, and any date/time that can be manually entered by users is in respective user’s time zone. To help us even more, the time zone used is not stored in documents, but only in user profile, so to be really sure which time is meant, one has to find the user who did the data entry or update, and then find the time zone and do conversion if necessary. SAP gives a good example in OSS note 636992. There, a user sitting in Japan creates a notification about, for example, machine breakdown, entering local time. Several hours later, a colleague in Germany looks at the notification and thinks that the machine has been down only a few moments, while it’s actually several hours!
    Things are enough confusing if you are analysing some problem by looking at the data. And if you are creating documents (material movements, accounting postings or production order confirmations) from ABAP programs with, for example, BAPI functions, you have to be especially careful because the system will run checks on date and time fields, with different logic. In general, the posting date (BUDAT or, as in BAPIs, POSTG_DATE) and several date/time fields like EXEC_START_DATE, EXEC_START_TIME, EXEC_FIN_DATE, EXEC_FIN_TIME, EX_CREATED_DATE/TIME in confirmations in the BAPI function BAPI_PRODORDCONF_CREATE_TT are your local date and time. While creating order confirmations, the system will check the date/time against the user local date and time and will prevent creating confirmations in the future. In contrast to PP, the BAPI to create a goods movement - BAPI_GOODSMVT_CREATE - assumes that posting date is a local date, but doesn’t complain if it’s in the future. The potential problems can be hard to find and detect: if you have small time differences, the posting date can differ only during one-two hours per date - only then you will get an error when posting an order confirmation. For all those fields mentioned above you should normally use the system fields SY-DATLO and SY-TIMLO if they have to be populated with current date and time. If the data is provided by an external system, then either the system has to care about the correct time, or your ABAP program has to do time zone conversion.
    In certain situations you can assume that if a document is being created for some plant, then the current server time can be converted into local time of the plant, if you know the time zones of both. The server’s time zone, or more exactly, its difference with UTC, can be found in the system variable SY-TZONE. To find the time zone of a plant, you can use the logic that can be found in the function CO_R0_SET_LOCAL_DATE_AND_TIME.

  • HELP - How to Convert Date in GMT to Local time in Applet

    Hi All
    Is there a way to convert a date from GMT format into a local time say IST in my Java applet, this GMT date is coming from a postgresql database.
    Thanks in advance
    Swaraj

    Try this with your customization:
    java.text.SimpleDateFormat format0 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    java.text.SimpleDateFormat format1 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    java.util.Calendar cal0 = Calendar.getInstance(new SimpleTimeZone(0, "GMT"));
    java.util.Calendar cal1 = Calendar.getInstance(new SimpleTimeZone((int)(5.5*60*60*1000), "IST"));
    format0.setCalendar(cal0);
    format1.setCalendar(cal1);
    java.util.Date date = format0.parse("2003-01-25 00:15:30");
    java.lang.String formatted = format1.format(date);
    System.out.println(formatted);

  • Converting UTC time stamp to local time (CET)

    Is there a smooth way to convert a time stamp from UTC time into the local time (e.g. CET)?
    CONVERT TIME STAMP.... Just converts the timestamp from local time zone to UTC, is there another comand to perform the opposite conversion?
    TIA!
    /Armin

    Hi Armin
    The statement does not only convert from local time zone to UTC you can specifiy any timezone:
    CONVERT TIME STAMP time_stamp TIME ZONE tz
            INTO [DATE dat] [TIME tim]
            [DAYLIGHT SAVING TIME dst].
    The following statement can also be used to convert from date time to timestamp.
    CONVERT DATE dat [TIME tim [DAYLIGHT SAVING TIME dst]]
            INTO TIME STAMP time_stamp TIME ZONE tz.
    Regards
    Faaiez

  • Convert XML string into an abap format date and time

    Hi,
    Does anyone know of a method or a function module in ABAP which converts XML string into an abap format date and time.
    Here is a part of the xml that I want to convert.
    <ns2:EventDateTime>2009-07-02T10:13:45+10:00</ns2:EventDateTime>
    <ns2:EventMessageTransmissionDateTime>2009-07-02T10:13:45.987+10:00</ns2:EventMessageTransmissionDateTime>
    Currently EventDateTime and EventMessageTransmissionDateTime are type XSDDATETIME_Z and these are converted to proper dates and times. We will be changing these fields to a STRING instead of XSDDATETIME_Z. The reason for this is to make the field more versatile. The customer would be receiving dates with Zulu (2009-09-23T12:00:00Z), with offsets (2009-09-23T12:00:00+10:00/-10:00) and just local timestamp (2009-09-23T12:00:00). With this, we need to make the date fields as string
    to be able to accept the various date formats (esp. the local timestamp).
    I am looking for a standard function module or method that will convert the xml string to a proper date and time abap format.
    Would appreciate anyone's help!
    Thanks.
    Edited by: eunice ocson on Jul 13, 2009 1:49 AM
    Edited by: eunice ocson on Jul 13, 2009 1:50 AM
    Edited by: eunice ocson on Jul 13, 2009 1:51 AM
    Edited by: eunice ocson on Jul 13, 2009 1:51 AM

    Hi Eunice
    Use the FM 'SMUM_XML_PARSE'
    for more info
    [Convert XML string to ABAP|XML String to ABAP or GUI]
    hope it helps you.
    Thanks!!

  • How do you return System Time of the local box in FTP command

    How do you return System Time of the local box in FTP command... since I want to output the system time of my local box copying to the FTP server...

    Its asking me to enter a new date... I actually want to return it into a log file since I am using ws_ftp.... but the log files dont have any date time being returned... i just want to be able to echo that date time into the log file... but it doesnt do that... I also tried
    SHELL ECHO %DATE% %TIME%
    but it returns this in the log file
    Processing Line 10 [SHELL ECHO %DATE% %TIME]
    I also tried in my ws_ftp script and it says:
    Processing Line 15 [!Date]
    Sending command [!Date] with parameter []
    !Date
    500 '!DATE': command not understood
    Failure in command [!Date]

  • Cannot GR due to the time difference between System Time & Local Time

    Hi All,
    We are facing any issue where the user can not do the GR as per the scheduling aggreement before 9:00am. We figured out the root cause being the difference btween the system time & local time but we are not sure. The system date is behind a day before 9:00am. For e.g. when it is 1st January 23:59 hrs system time, the local time is 2nd January 08:59 hrs. The system is not allowing GR for the earlier / later date.
    Can anybody tell us what could be the issue?
    Regards,
    Abhijit

    Closed

  • Remove Local System from Change The System Time

    Hello,
    Is there any way to remove the Local Service account from policy "Change the system time"?
    I created a policy to only give permission for the Administrators and Power Users group, but when I run the AccessChk tool, the result is:
    administrators
    Power Users
    Local System
    Regards

    > Is there any way to remove the Local Service account from policy "Change
    > the system time"?
    No. Local System is the "godfather of your computer" and cannot be
    restricted.
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

Maybe you are looking for