Convert Oracle date format masks to Java format masks

Have an application based on Oracle that stores data in text form (for display) and in native date format. It is being migrated to another application with a Java based front end that can only use Java format masks to display the dates in the desired display format.
Is there a way to translate the Oracle format masks to Java? I can do this in SQL or PL/SQL using the database or in Java.
I really don't want to write detailed code to parse the masks, although if parsers are available to take an oracle mask into its metadata (minute, year, etc), it may be possible for me to write the code.
This seems like something that must have been done many times over the years. I would prefer to reuse workable code rather than reinventing the wheel.
To be clear, I do not need to alter data or convert dates shown in string form. Just the format masks so the new app will display dates in the same manner as the old app. Fortunately, both apps handle interpreting the format masks in their native technology, so it is just converting the format mask.

kenmadsen wrote:
Both applications have a varchar2 column and a date column. A date picker selects and returns the date in native format for storage and the application uses the mask to format the varchar2 column for display (and storage). The old application uses an Oracle date format mask DD-Mon-YYYY HH24:MI and the new application uses Java date masks (DD-MM-YYYY hh:mm). (I may not have the translation from HH24 to hh correct).
The date column and the display column store the same information (a date), but one is stored natively and the other is displayed as the application administrator want the particular row to be formatted for display. (the mask is a column in the same table as the other 2 columns). Each row has characteristics (other columns) that determines what the data is and how it should be shown (some things need to show time; others only the date)
So the problem is, when migrating, the new application cannot render the dates as the old app did because "Mon" is Oracle format, not Java format.
No data is being converted in the migration, except for the mask itself. Both applications have the same record structure with respect to these columns and they both use the mask to generate the formatted varchar2 data for display in the application and storage.too bad you insist on try to describe with words rather than actual CODE.
Please explain again why this is an Oracle problem & NOT a Java problem?
Oracle RDBMS is a data repository & can't automagically change data content for you.

Similar Messages

  • 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 Oracle XML Query Result in Java String by using XSU

    Hi,
    I have a problem by converting Oracle XML Query Result in Java
    String by using XSU. I use XSU for Java.
    For example:
    String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
    preise ps where match='"+args[0]+"'");
    String datum1=datum;
    I become the following error:
    Prototyp.java:47: Incompatible type for declaration. Can't
    convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
    Can somebody tell me a method() for converting to solve my
    problem??????
    Thanks

    Hmmm.. Pretty basic just look at the example:
    OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
    String xmlString = qry.getXMLString();
    Hi,
    I have a problem by converting Oracle XML Query Result in Java
    String by using XSU. I use XSU for Java.
    For example:
    String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
    preise ps where match='"+args[0]+"'");
    String datum1=datum;
    I become the following error:
    Prototyp.java:47: Incompatible type for declaration. Can't
    convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
    Can somebody tell me a method() for converting to solve my
    problem??????
    Thanks

  • How to convert oracle form fmb file to java swing file using Jdeveloper

    how to convert oracle form fmb file to java swing file using Jdeveloper.Please explain with detailes steps if possible or please give a link where it is available
    thanks
    Message was edited by:
    user591884

    There is no automatic way to do this in JDeveloper. I know there are some Oracle Partners offering forms to java conversion, I don't know how much of their tools are automated and done with JDeveloper. With JDeveloper+ADF you basically rewriting the Forms application from scratch (and using ADF is helpful during this process).

  • Converting sql timestamp into a usable java format??

    hi there.
    does anyone know how to convert an sql timestamp into a usable java format? i have retrieved a timestamp from a mysql table in a jsp script and would like to convert it into the following format:
    12:42pm | 08.07.02
    as i understand it, i'll need to convert the timestamp into seconds since 1970 and then manipulate it as a calendar object? my first line is working, but i don't know what to do after...
    java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
    next...?
    any help would be much appreciated!!
    thanks.

    please excuse my java sytnax ignorance, but i've tried a bunch of different syntax arrangements and can't figure out how to use the getTime() method. what comes after my first line there?
    java.sql.Timestamp sqlTimestamp = resultSet.getTimestamp("date_and_time");
    then something like:
    long msec=date.getTime(sqlTimestamp);
    but that doesn't seem to work...
    thanks for any help!

  • Converting the DATE(yyyymmdd) into MONTH(yyyymm) format

    HAI
    I have one date InfoObject(ZDATE) in the format of YYYYMMDD format.
    My client wants another 'Month InfoObject(ZMONTH) in the format of YYYYMM . This ZMONTH infoobject should be derived from ZDATE.
    So please tell me how can i convert the ZDATE data into ZMONTH format.
    I think , it is possible by writing the ABAP code.
    Please give the ABAP CODE for converting the ZDATE data into ZMONTH format also .
    i wll assing the points
    bye
    rizwan

    Hi Rizwan,
    You can use offset like:
    zmonth = zdate+0(6)
    Zmonth is variable in which yyyymm is going to be stored
    and zdate is variable in which yyyymmdd is stored.
    I think this will slove your issue.
    Thanks=points

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • How to convert Oracle Data into Java Date

    Hi there,
    in JDev 3.2 oracle.jbo.domain.Date was derived from oracle.sql.DATE, which has a timestampValue() method to get a java.sql.Timestamp.
    In Jdev 9.0.3 Date is not!! derived from oracle.sql.DATE, so my previous implementation fails.
    So, How can I get a java.util.Date from oracle.jbo.Date?
    ( I think this is a bug !?)

    Hi Dietmar,
    this is documented in the help; see Reference - Business Components Oracle Domains; then choose 'Date'
    using the dateValue() method on the oracle.jdo.domain.Date gives you a java.sql.Date which is a (subclass of) java.util.Date.
    Cheers, Hans

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

  • Converting raw data from memory to OTF format

    hi all,
         i have a requirment where i need to submit a report and move the corresponding output to memory get the same back in OTF format and export it in an RFC.  i tried using different function modules but could not find the exact where i can convert from memory to OTF format or directly at the time of submit can store it in OTF format.
          tried converting list to asci but could not get the same report output,
    thanks,
    raju,

    Hi krishnam,
    You can try this function module
    SX_OBJECT_CONVERT_OTF_RAW
    Regards
    Sumit Bhutani

  • How to convert Oracle data types to ABAP types.

    Hi,
    I have this oracle table table:
    Type of col.
    Char(6)
    Number
    Number
    Number
    Number
    Date
    I dont know how to convert column of number to abap types. I use exec sgl syntax and I try to insert value to abap structure. But structure <dyn_wa> is wrong.
      EXEC SQL PERFORMING loop_output.
        SELECT *
            INTO   :<dyn_wa>
            FROM   BIND_VAT_CB_SUM_VIEW@DTRTST1
      ENDEXEC.
    ENDFORM.                    "get_data
    Thanks

    HI,
    REPORT demo_native_sql.
    DATA: BEGIN OF wa,
            connid   TYPE spfli-connid,
            cityfrom TYPE spfli-cityfrom,
            cityto   TYPE spfli-cityto,
          END OF wa.
    DATA c1 TYPE spfli-carrid VALUE 'LH'.
    EXEC SQL PERFORMING loop_output.
      SELECT connid, cityfrom, cityto
      INTO   :wa
      FROM   spfli
      WHERE  carrid = :c1
    ENDEXEC.
    FORM loop_output.
      WRITE: / wa-connid, wa-cityfrom, wa-cityto.
    ENDFORM.
    See the below SAP link for more info
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm
    Thanks
    Sudheer

  • Convert oracle developer 6i form into java(jdeveloper)

    hi
    can any bady tell me how can i change my oracl form to jdeveloper
    thanks in advance

    You can.
    Install the oracle forms tables with system users, you can find the scripts in the path; c:\orant\tools\dbtab60.
    You will find several scripts, run those scripts then you can save your forms, menus,.. to database
    Regards

  • Is there any function module to convert the date format

    Dear ABAPers,
    Is there any function module to convert the date format from dd.mm.yyyy to dd-mmm-yyyy.
           I want to convert the date format from dd.mm.yyy to dd.mmm.yyy Eg.from 10.03.2008 to 10-mar-2009.
    Thanks & Regards,
    Ashok.

    hi,
    create custom function module or copy the below code in the report ..and use it
    the out put for below is :----Convert a DATE field into a full format date eg. March 23, 2000
    FUNCTION Z_CONVERT_DATE_INTO_FULL_DATE.
    ""Local interface:
    *"       IMPORTING
    *"             VALUE(DATE) LIKE  SY-DATUM
    *"       EXPORTING
    *"             VALUE(FORMATTED_DATE)
    *"       EXCEPTIONS
    *"              INVALID_DATE
    TABLES: TTDTG.
    DATA: BEGIN OF T_DATE,
            YYYY(4) TYPE C,
            MM(2) TYPE C,
            DD(2) TYPE C,
          END OF T_DATE.
    DATA: DAY(3) TYPE N.
    DATA: VARNAME LIKE TTDTG-VARNAME.
    IF DATE IS INITIAL.
      CLEAR FORMATTED_DATE.
      EXIT.
    ENDIF.
    check document date format
    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        DATE = DATE
      EXCEPTIONS
        PLAUSIBILITY_CHECK_FAILED = 1.
    IF SY-SUBRC NE 0.
      RAISE INVALID_DATE.
    ENDIF.
    MOVE DATE TO T_DATE.
    CONCATENATE '%%SAPSCRIPT_MMM_' T_DATE-MM INTO VARNAME.
    SELECT SINGLE * FROM TTDTG WHERE SPRAS = 'EN' AND VARNAME = VARNAME.
    WRITE T_DATE-DD TO DAY.
    CONCATENATE DAY ',' INTO DAY.
    CONCATENATE TTDTG-VARVALUE DAY T_DATE-YYYY INTO FORMATTED_DATE
      SEPARATED BY SPACE.
    ENDFUNCTION.
    the output is :--Convert a DATE field into a full format date eg. March 23, 2000
    Regards,
    Prabhudas

  • Get start and end date for posting period (YYYYMMM format)

    In revenue recognition I'd like to have the start date and the end date of the posting period, which is in format YYYYMMM. It's field VBREVR-BDJPOPER.
    Any idea?
    I had no luck so far to find a relevant FM.
    Thanks in advance,
    Peter

    Hi,
    Use this FM To convert the date into DD.MMM.YYYY format
    <b>CONVERSION_EXIT_SDATE_OUTPUT</b>.
    Use the followiong FM To convert the date into <b>user specified</b> format
    <b>SLS_MISC_CONVERT_TO_DATE</b>     
    Rewaed if helpful.
    Regards,
    Sandhya

  • Convert XMP Date and Time

    Hi, in my script I am trying to read the Date and Time using the XMP functions of a selected file in bridge.  Then, I want to convert that date and time into a format that looks like: "01/12/10 | 01:23 PM" and write that to another metadata field like the description.  Im stuck on trying to convert the date and time into what I want it to look like?  Can anyone help, thanks!
    Here is the part of the code I'm having trouble with:
    When I read the dateTimeOriginal property of the file, it is in an unfriendly format.  It looks odd and shows the time zone.  The commented lines is code that I have tried, but didn't work.  I was trying to convert the XMPDateTime object into a Date object so I can adjust the format, but I haven't been successful.
    var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);      
          var myXmp = myXmpFile.getXMP();   
          var Name = myXmp.getProperty(XMPConst.NS_EXIF, "DateTimeOriginal");
          var date = new XMPDateTime(new Date(Name));
          var date2 = new Date(date);
          //dateFormat.masks.portfolioDate = 'mm/dd/yy "|" hh:MM TT';
    //date.format("portfolioDate");
    //date2.format("mm/dd/yy");
    alert(date2.toString());
    Name.convertToLocalTime();
    Name.toString();
    alert(Name);

    Thanks for helping me out Paul.  I just have one more small problem.  I am trying to access the Headline XMP property, and I know i need to use the IPTC Core property, but it doesn't seem to work.  Here is my current code, can you help me out?
    var selectedFile = thumb.spec;   
    var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);      
    var myXmp = myXmpFile.getXMP();   
    var xmpString = myXmp.getProperty(XMPConst.NS_EXIF, "DateTimeOriginal").toString();
                alert(xmpString);
    var xmpString2 = myXmp.getProperty(XMPConst.NS_IPTC_CORE, "Headline").toString();
    alert(xmpString2);
    var dat =xmpString.match(/(\d+).(\d+).(\d+).(\d+).(\d+).(\d+)/);
    var amOrPm = "AM";
    var hours = Number(dat[4]);
    if (hours > 11) amOrPm = "PM";
    if (hours > 12) hours = hours - 12;
    if (hours > 11) amOrPm = "PM";
    if (hours < 10) hours = '0' + hours;
    var dateString = dat[2]+"/"+dat[3]+"/"+dat[1].substr (2) +" | "+ hours +':'+dat[5]+ ' ' +amOrPm;

Maybe you are looking for

  • Types

    What are the type of reports available in SAP? Diff each and every typef of reports? Also tell me the real time applications of reports?

  • Smart directories don't update smart in dock

    An half bug ? When I put my smart directory in the dock, it don't update. You can see it in the snapshot : my last file about Jeanne d'Arc don't appears. But sometimes it work well, i don't know why ? It's like window in file drag'n'drop that sometim

  • How to disable SELINUX on Redhat

    Hi Experts, I want to disable SELINUX on redhat its a client requirement. Please give input to set this value..... Thanks, Mouni.

  • Adding taskpads to MMC getting information from $COL i where i 2

    I am writing some scripts to help our servicedesk to some of their tasks, and I wanted to add it as Taskpads in MMC What I have done, open MMC, add ADUC . Then create a "taskpad" for an OU, and create a task to do "X", when I choose parameters and fo

  • Can't connect to YouTube via iPhone 4

    Suddenly, I can't connect to YouTube any longer. My sign in info is gone and I can't sign back in because it won't connect to YouTube to even do that. I de-synced and resynced everything and it didn't help. Everything else on my iPhone 4 is working n