Date format conversion from yyyy-mm-dd to mm-dd-yyyy

Hello Experts,
In my application one of the context element
wdContext.currentContextElement().getEmployee_employmentDate()
returns the value as 1978-06-15.
Can any one suggest me how to convert this date into          06-15-1978 in webdynpro java.
Thanks and help is really appreciate.

Hi Bala,
It tried this
import java.util.*;
import java.text.*;
SimpleDateFormat formatter
= new SimpleDateFormat ("mm-dd-yyyy");
Date day = wdContext.currentContextElement().getEmployee_employmentDate()
System.out.println("for:" + formatter.format( day ));
...the format is changed 1978-15-06....but now the but is overwritten by 00. it outputs 00-15-1978.
Do I need to include any other step in between??
Thanks,
James

Similar Messages

  • Reg : date format conversion from dd.mm.yyyy to mmddyyyy

    hi ALL,
    is there any function module which can convert date format
    from <b>dd.mm.yyyy to mmddyyyy</b>.
    Thanks in advance

    Hi,
    Please check the following
    CONVERSION_EXIT_PDATE_INPUT Conversion Exit for Domain GBDAT: DD/MM/YYYY -> YYYYMMDD
    CONVERSION_EXIT_PDATE_OUTPUT Conversion Exit for Domain GBDAT: YYYYMMDD -> DD/MM/YYYY
    SCA1 Date: Conversion
    CONVERSION_EXIT_IDATE_INPUT External date INPUT conversion exit (e.g. 01JAN1994)
    CONVERSION_EXIT_IDATE_OUTPUT External date OUTPUT conversion exit (e.g. 01JAN1994)
    CONVERSION_EXIT_LDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD)
    CONVERSION_EXIT_SDATE_INPUT External date (e.g. 01.JAN.1994) INPUT conversion exit
    CONVERSION_EXIT_SDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD)
    TB01_ADDON
    CONVERSION_EXIT_DATEX_INPUT
    CONVERSION_EXIT_DATEX_OUTPUT
    Hope this would surely help you out.
    Thanks and regards,
    Varun.

  • Date Format Conversion from MM.DD.YYYY to YYYYMMDD

    Hi All,
    I am trying to load data from r/3, and i have date format as MM.DD.YYYY in source system.how can i convert this into YYYYMMDD format in transfer rules(I know that we have to write a routine in transfer rules).Could anybody help me out pl?..pl give me conversion routine for it.
    Here BW Filed is 0DATE and R/3 Filed is ZZDATE.
    regards
    murali.
    Message was edited by: Murali

    Hi,
    Try to under stand what I am asking :
    <b>What is the domain(or data type) used for the ZZDATE field.</b>
    Ok ,
    If some records are having proper format and others are having wrong format, even we canot correct this with routine also. So in this case you have to edit manually at PSA, then do upload.
    You are right, when we are populating data to ODS , if there is any wrong format of value, it will not disply the error at the time of loading .It will through the error at the time of activation.
    With rgds,
    Anil Kumar Sharma .P

  • Date format conversion from MySQL

    Hi my dear friends. I have some problem with the date format.
    I am using MySQL version 3, LabSQL and Labview7.1
    In the MySQL, the date format reads as 2006-12-18 14-51-25
    while, when querying in Labview, it reads 18-Dec-06 14-51-25.
    So when using this date (18-Dec-06 14-51-25) to query further. I got problems as MySQL does not recognise this format.
    How can I convert 18-Dec-06 to 2006-12-18?
    It might sound easier to change but for the year how do I change it to proper 2006, not 1906?
    Your solution will be helpful. Thanks in advance.
    Clement

    astroboy wrote:
    Hi Ravens. I think that not all computers have the same settings. Is there a way how can make sure that it still works despite of different settings in esch PC?
    By auto-changing registry?
     Clement
    There probably is a way to do that, but I don't know how.  I don't think it is a good idea to change the PC settings in that way because it would interfere with all other programs on the PC.  Suppose the user wants the format of date and time to remain the way it is for other programs or looking at file/directory properties.
    Rather than basing your functions on the system format settings, use the format string functions within labview that will make the date/time to appear the way you want it to.  Look at the format date/time string function on the timing palette.  Also, format into string on the string palette.

  • How to convert the date format 'm/d/yyyy hh:mi:ss AM' to 'MM/DD/YYYY HH:M'

    How can i convert a the date format 'm/d/yyyy hh:mi:ss AM' to 'MM/DD/YYYY HH:MI:SS AM' in Oracle
    I have a query
    select UPPER(t.val_10) "TYPE", count(val_3) "Number of Transfers"
    from table1 t
    where t.is_active = 1
    and t.val_4 = 'INBOUND'
    and to_date(to_date(val_5,'MM/DD/YYYY HH:MI:SS AM'), 'DD/MM/YY') between to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY') and add_months(to_date(to_date('01/08/2008 00:00:00','DD/MM/YYYY HH24:MI:SS'), 'DD/MM/YY'),1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)
    I get the error [ORA-01861: literal does not match format string which i think is because
    val_5 has the values in the following format:
    8/29/2008 6:31:10 PM
    Does anyone have an answer?
    Thanks in advance
    Edited by: user2360027 on 26-Mar-2009 03:50                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    first off, you've got to_date(to_date(...)) - NEVER do this - you're forcing an implicit to_char which can cause all sorts of problems!
    What is the data type of your column val_5? If it's DATE then your query is simply:
    select UPPER(t.val_10) "TYPE",
           count(val_3) "Number of Transfers"
    from   table1 t
    where  t.is_active = 1
    and    t.val_4 = 'INBOUND'
    and    val_5 between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)If it's a varchar2 (why, oh why, oh why, ...?!), then your query should be:
    select UPPER(t.val_10) "TYPE",
           count(val_3) "Number of Transfers"
    from   table1 t
    where  t.is_active = 1
    and    t.val_4 = 'INBOUND'
    and    to_date(val_5, 'mm/dd/yyyy hh:mi:ss AM') between to_date('01/08/2008','DD/MM/YYYY') and add_months(to_date('01/08/2008','DD/MM/YYYY') ,1)
    group by UPPER(t.val_10)
    order by UPPER(t.val_10)Remember that dates in DATE format are stored in an internal Oracle format - in order for you to tell Oracle that your string is a date, you need to use to_date. When you want to retrieve a date, you need to use to_char to put it into the format you want to see it in.
    Remember also that your nls_date_format defines the default format that you'll see a date, which is what is used in the implicit conversion that oracle does when you select a date:
    SQL> alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    26/03/2009 11:01:53
    1 row selected.
    SQL> alter session set nls_date_format='mm/dd/yy hh12:mi:ss AM';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    03/26/09 11:02:24 AM
    1 row selected.It doesn't make sense to convert something that's already in a DATE format into a DATE format - in order to do that, oracle has to first change the date into a string, and it does that by using the nls_date_format parameter setting - if you're working with dates-in-strings that are in a different format, then all sorts of problems arise, as you have found out!

  • RE: Oracle DATE data format conversion..

    <C.M> Motta's question about dates and oracle>
    Dealing with dates and Oracle is somewhat of a nuisance. Oracle is very
    particular about how date strings are formatted, and if you get it wrong,
    you get the (unhelpful) message that C.M. Motta showed us. However, if
    you pass a DateTimeData to Oracle, Forte' does the right formatting for you.
    If you do need to format the date prior to interacting with Oracle, use the
    following format:
    dd-mmm-yy <time component>
    You can change the default format, but it is not easy.
    If you customise Express generated code that interacts with an Oracle
    database, again, make sure that you pass a DateTimeData, and not the
    .TextValue.
    Good luck!
    Richard Kirk

    Date: Wed, 06 Nov 1996 08:18:37 -0500
    To: "C. M. Motta" <[email protected]>
    From: Jim Milbery <[email protected]>
    Subject: Re: Oracle DATE data format conversion..
    Cc: [email protected]
    Cheers:
    Most likely what is happening is that you are using the default date
    format of Oracle, and you are sending a four-character year. As follows:
    SQL> insert into jimbo values ('01-dec-1997')
    2 /
    insert into jimbo values ('01-dec-1997')
    ERROR at line 1:
    ORA-01830: date format picture ends before converting entire inputstring
    >
    Oracle defaults to a format of 'dd-MON-yy'
    You can either truncate the year, or manipulate the date to match the standard
    database as follows:
    insert into jimbo values (to_Date('01-jan-1997', 'DD-MON-YYYY'))
    \jimbo
    At 09:21 AM 11/6/96 -0200, you wrote:
    Forte Users,
    First, Id like to thank all those who answered my question on
    droplist & SQL. I got just what I was looking for: its up and runnunig
    now.
    I have another question: Im trying to insert a DATE into an Oracle
    database. The source date is:
    data : DateTimeData = new;
    data.SetCurrent();
    So, when I try to insert data.Value or data.textvalue into DB, I
    get the following exception:
    ORA-01830: date format picture ends before converting entire
    input string.
    Are there any suggestions?
    Thanks for your help,
    C.M. Motta
    ====================================================================
    Jim Milbery
    Milbery Consulting Group
    132 N. West St., Allentown, PA 18102
    O: 610 - 432 - 5350 F: 610 - 432 - 5380
    E-Mail : [email protected]
    ====================================================================

  • Regarding Date Format Conversion

    Hi,
    In my project i am picking the date from the date picker which is a javascript program . Then i am displaying it on a jsp page .It is coming in mm/dd/yyyy format .I have to change it to dd/mm/yyyy format .
    I have the code for date formatting conversion .
    What my doubt is whether  the code should be written inside the jsp page or in the javascript .
    Thanks .

    Hi
    <%@page language="java" import="java.sql.*,java.util.*,java.text.*" %>
    <%SimpleDateFormat sdf= new SimpleDateFormat(dd/mm/yyyy );%>
    <% java.util.Date temp_date = sdf.parse(PassYourDateHere); %>
    use this with your jsp
    Regards
    Abhijith YS

  • Date Format Conversion Problem

    Hi I am having trouble converting excel files to PDF.
    I am in Australia and so we use the date format dd/mm/yyyy.
    However when I convert to PDF it changes the date to the American format mm/dd/yyy.
    For example if the date in Excel is 07/08/2013 (7th of August 2013) after conversion to PDF it displays as the 08/07/2013 (8th of July 2013).
    Can someone please tell me how to get Adobe CreatePDF to convert to the correct date format?

    DrClap wrote:
    From the API documentation for SimpleDateFormat:
    "Text can be quoted using single quotes (') to avoid interpretation."
    So your format should be:"yyyy-MM-dd'T'kk:mm:ss.SSz"(Note that I added the "z" at the end to handle the timezone part of your input.)From the description of the OPs problem - that of obtaining the "date" information from an XML file - it seems easier to remove the unwanted characters than to add single quotes where needed.

  • Need regular expression for oracle date format 'DD-MON-YYYY'

    Hi,
    Can anybody tell me the regular expression to validate date in 'DD-MON-YYYY'.
    My concept is i have a table with just two columns item_name and item_date
    Both fields are varchar2 and i want to fetch those records from this table which have valid date format('DD-MON-YYYY').

    If it must be a regexp, this is a starter for you, note it carries the caveats mentioned by both posters above and in the linked thread
    mkr02@ORA11GMK> with data as (select '10-jan-2012' dt from dual
      2  union all select '10-111-2012' from dual
      3  union all select 'mm-jan-2012' from dual
      4  union all select '10-jan-12' from dual)
      5  select
      6  dt,
      7  case when regexp_like(dt,'[[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4}','i') then 1 else 0 end chk
      8  from data
      9  /
    DT                 CHK
    10-jan-2012          1
    10-111-2012          0
    mm-jan-2012          0
    10-jan-12            0It will not validate content, only string format.
    And to emphasis the points made in the linked thread - dates in text columns is poor design. Always.

  • Problem with  date format "dd-MM-yyyy"

    hi all,
    i am using jdev 10.1.3.2
    My application ADF Swing app.
    in my database i have a table employee which contains "birthday".
    my problem is that i must use date format"dd-MM-yyyy".
    i added this format into "formatinfo.xml" file.
    than i choose it in my EO.
    i create a form which contains employees.
    for example i have an employee with a birthday=25-10-1970
    in my text field if user puts "1970-10-25"'which is not the best format) he will have a correct result "25-10-1970"
    but if user puts "25-10-1970" he will have as result "21-02-0031" which is not the real value.
    please help me.
    thanks.
    PS: i did some research before posting but i didn't find yet

    Rouz,
    Did you try what i said before?
    * Open you EntityObject
    * Expand the attribute tree
    * Choose your DOB attribute
    * Choose the Control hints pane on the right
    * Choose Formater: Simple date format
    * Choose Format mask dd-MM-yyyy
    Run your application and try it.
    This is how i change the format and it works perfectly.
    I uses the correct format to show the date and it enables me to edit the date using the format mask dd-MM-yyyy
    Edit: I just tried it myself. I can only reproduce it by removing my mask. Ergo, the application expects the default american format yyyy-MM-dd. By entering a date in the format dd-MM-yyyy the framework will convert it to yyyy-MM-dd and you'll end up with 0031-02-21.
    CONCLUSION follow the steps i discribed above to set your mask and you'll be fine.
    Message was edited by:
    Smolders Johan

  • How can i change the date format mm/dd/yyyy to dd/mm/yyyy

    How can i change the date format mm/dd/yyyy to dd/mm/yyyy

    Date, time and currency formats are controlled via Settings > General > International > Region Format - you can't just change the date format

  • How test the date formats  M/d/yyyy and MM/dd/yyyy .

    how test the date formats M/d/yyyy and MM/dd/yyyy .format should accept 3/3/1982 and 03/03/1982 dates.
    please help me

    georgemc wrote:
    kajbj wrote:
    Spoiler: Reply #3 is actually the answer to your question.Also, Bruce Willis is a ghost, the Titanic sinks and Verbal is Keyzer Soze.Only one of those endings really surprised me.
    You should've heard me in that theatre when the Titanic struck that iceberg...

  • How to set date formate dd/mm/yyyy from portal.

    Dear Experts,
    We are implementing ESS/MSS, my query is under ESS applications, date format is showing mm/dd/yyyy, then iam trying to change  user language is English (United Kingdom), from portal end, then its showing dd/mm/yyyy.
    My query is that is there any other way to change date format and how to set user language is English( united Kingdom) for mass users.
    Thanks in advance,
    Regards,
    Mahee.

    Hi,
    Iam trying to upload below format..for mass users....
    [User]
    UID=<employeeid>
    Password=init@123
    FIRST_NAME=xxx
    LAST_NAME=xxx
    group=xxxx
    Language=en_GB
    [User]
    by changing launguage = English (United Kingdom),Now I can able see the require format...dd/mm/yyyy.
    Thanks and Regards,
    Mahee.

  • URGENT !!!!   Problem with Date format MM/DD/YYYY in oracle database to BW

    Hi
    I am wondering if somebody can help me urgently.
    I have oracle database where date is of the format MM/DD/YYYY and I am loading data into BW. DATE data type
    Date in oracle database: 3/30/2007
    First when I used InfoObject ZDATE (with 0DATE) reference (DATS data type) data load failed saying that
    'Value '30-MAR-0 ' of characteristic 0DATE is not a number with 000008 spaces'
    Then I created ZDATE InfoObject as CHAR Type (Length 10) with PDATE Conversion Routine.
    when I created datasource using DB Connect and checked the contents using 'Display Table Contents' after creating data source the data field distorted as
    AR/-0/30-M
    After data load. when I checked PSA
    The Date records look same as AR/-0/30-M
    In cube the field appeared as  30-MAR-0  (last digit of year disappearing)
    In BEx report also it looks like 'AR/-0/30-M'
    Can somebody help me as quickly as possible.
    What should I do if i want to still use DATS data type for ZDATE?
    should I change date format in database if so to what?
    If I should use CHAR type with PDATE or any other routine can somebody give me the routine to have the date in the report exactly as it appears in database?
    I also tried changing date format in user profile...settings. But still its the same.
    Thanks in advance.

    Hello Snrella,
    You can solve this by converting the date format from oracle to the SAP internal date format  using an ABAP routine in the transfer rules.
    Assuming the oracle data field name is ZODATE then here's the ABAP you can use in the transfer rules. Create an ABAP routine transfer rule from ZODATE to your ZDATE infoobject, and then put this ABAP code there. (this code assumes that the format of the date from oracle is MM/DD/YYYY).
    concatenate tran_structure-/BIC/ZODATE+6(4) tran_structure-/BIC/ZODATE(2) tran_structure-/BIC/ZODATE+3(2) into result.
    Hope this helps.

  • Problem with date format conversion

    Hi All,
    I was trying to load from a flat-file to an ods through psa. the file has a date format which is mm/dd/yyyy. i want to convert that to yyyymmdd. i created a custom object ZDAT for this field of type char with length 10. i wrote a code in transfer routine for the conversion as follows:
    DATA : ZT1 LIKE SYST-DATUM,
    STR1 TYPE STRING,
    STR2 TYPE STRING,
    STR3 TYPE STRING.
    SPLIT TRAN_STRUCTURE-/BIC/ZDAT AT '/'
    INTO STR1 STR2 STR3.
    CONCATENATE STR3 STR1 STR2 INTO ZT1.
    RESULT = ZT1.
    it reported error in PSA records while loading aS " Infoobject /BIC/ZDAT does not contain alpa-conforming value 20050321.
    P.s: for this record i was abt to load 03/21/2005 to zdat.
    thanks,
    anitha.

    hi anitha!
       ok!
      in the transferrules you use the ZDAT as an field for date in transferstructure. but in info source use the 0calday.
    so now
        you need to write your routine in the transfer rules for 0calday which can be derived from zdat which can be derived from the zdat.
    so your Transfer structure will be same as
       zmid, zmatgrp, zdat, zcid, zloc, zqty
    But your Info source must be like
       zmid, zmatgrp, 0calday, zcid, zloc, zqty
    and in transfer rule i suggest you to use the following code for the 0calday.
        DATA : ZT1 LIKE SYST-DATUM,
         STR1 TYPE char(2),
         STR2 TYPE char(2),
         STR3 TYPE char(4).
         SPLIT TRAN_STRUCTURE-/BIC/ZDAT AT '/'
         INTO STR1 STR2 STR3.
         CONCATENATE STR3 STR1 STR2 INTO ZT1.
         RESULT = ZT1.
    hope it makes things clear....
    with regards
    ashwin
    Message was edited by: Ashwin Kumar Gadi

Maybe you are looking for