Date format in XML conversion

Hello,
I am using oracle8i. The date format is not giving the proper date values in XML conversion..
create table test(dt date);
insert into test values(sysdate);
insert into test values(sysdate);
insert into test values(sysdate);
TEST.WORLD> select * from test;
DT
28-NOV-04
28-NOV-04
28-NOV-04
set autoprint on
set long 100000
set linesize 100000
set longchunksize 100000
var g_clob clob
declare
l_ctx dbms_xmlquery.ctxType;
l_clob clob;
begin
l_ctx := dbms_xmlquery.newContext('select dt from test');
dbms_lob.createtemporary(:g_clob,true,dbms_lob.session);
dbms_xmlquery.setdateformat(l_ctx,'yyyy-mm-dd');
:g_clob := dbms_xmlquery.getXml(l_ctx);
end;
Here is the output . It is dispalying the 03 For the month november.
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DT>2004-03-28</DT>
</ROW>
<ROW num="2">
<DT>2004-03-28</DT>
</ROW>
<ROW num="3">
<DT>2004-03-28</DT>
</ROW>
</ROWSET>

When you call DBMS_XMLQUERY.SETDATEFORMAT, you must supply the mask using the syntax defined by java.text.SimpleDateFormat.
You need to use "yyyy-MM-dd".
In your case, "yyyy-mm-dd", the lower case "mm" is the mask for minutes.

Similar Messages

  • Date format in xml file

    Hi,
    I am relatively new to XML and JSP.I am on a project where i have to transfer data to and from an Oracle 8i database to XML using JSP.everything worked fine except for the follwing:
    the date format in xml is always 'yyyy-mm-dd HH:MM:SS'.
    the datatype is date in oracle and string in jsp.when i try to upload the data in XML to oracle it gives me date format not recognised error.I ve tried using trunc and to_char in the query which fetches records into a recordset in JSP but to no avail.i keep getting the same format.
    Can someone please help with with having the date format as 'dd-mon-yyyy'.
    Thanks a heap for the help
    regards,
    Vinayak

    Hi,
    I ve tried out the solutions suggested by you and tried using java.sql.Timestamp
    as follow:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="oracle.sql.*" %>
    String dateString = rset.getString("installation_dt");
    java.sql.Timestamp date = new java.sql.Timestamp.valueOf(dateString);
    But tomcat throws up the following error
    :104:
    cannot resolve symbol
    symbol : class valueOf
    location: class java.sql.Timestamp
    java.sql.Timestamp date = new java.sql.Timestamp.valueOf(dateString);
    Hope you can help me.
    Thanks a heap
    Regards,
    Vinayak

  • How to change the date format in xml form?

    hi,
    How to change the date format in xml form?
    For example:  11/20/2008 3:00:03 PM    ->   11-20 03:00
    Any opinions greatly appreciated!
    Thanks.
    Edited by: ke wenxing on Dec 2, 2008 8:33 AM

    You could go to System - User Profile - Own Data would take you to the "maintain user profile screen"
    Click the defaults button and change the date format.This changes date format for all the dates in your login.

  • Date format in XML sys.dbms_xmlgen

    hello all,
    i have posted this question in "general XML " forum also....so please dont mind
    i am using following query to generate insert SQL statements
    SELECT
    'insert into ' || table_name || ' (' || (select rtrim(extract(xmlagg(xmlelement(e, t.column_value.getrootelement() || ',')),'//text()'),',') from table(xmlsequence(t.column_value.extract('ROW/*'))) t) || ') values (' ||
    (select dbms_xmlgen.convert(rtrim(extract(xmlagg(xmlelement(e, '''' || t.column_value.extract('//text()') || ''',')),'//text()'),','),1) from table(xmlsequence(t.column_value.extract('ROW/*')))t) || ');' ins_stmt
    from user_tables,
    table(xmlsequence(dbms_xmlgen.getxmltype('select * from ' || a_TblName ||' WHERE MODIFIEDON >'||a_date).extract('ROWSET/ROW'))) t
    where table_name in (select table_name from user_tables where table_name =a_TblName);but when i execute the procedure as
    sql> exec   Gen_Insert_Statement('11-jun-2009');
    ORA-19202: Error occurred in XML processing
    ORA-00904: "JUN": invalid identifier
    ORA-06512: at "SYS.DBMS_XMLGEN", line 288
    ORA-06512: at line 1
    ORA-06512: at "MRILDATA17TEST.GEN_INSERT_STATEMENT", line 22
    ORA-06512: at line 2     and if i do this
    SQL> exec Gen_Insert_Statement('11-06-2009');
    begin Gen_Insert_Statement('11-06-2009'); end;
    ORA-01843: not a valid month
    ORA-06512: at line 2is there any format to pass date while using XML packages??? i am also not getting in which this issue is occuring??
    any suggestion will be appreciable
    thanks and regards
    VD
    Edited by: dixit on Aug 13, 2009 6:15 AM

    thanks for not replying

  • Changing date format in XML form!!

    Hi,
    I have created a form by using XML form builder.I have many date fields in the form. I want to change the date format of date field from default MM.DD.YY to DD.MM.YYYY.
    Helpful answer will be appreciated with points.
    Regards,
    Dharam

    Hi Dharam,
    you can change the date format in the KM Layout set as described here:
    https://www.sdn.sap.com/irj/sdn/thread?threadID=240057
    but the XML Forms functionality does not refer to the additional format information set on he property as you can read here:
    https://www.sdn.sap.com/irj/sdn/thread?threadID=105044
    Hope this helps,
    Robert

  • Strange date format from XML

    Hi There!
    We have an XML that we read into an XMLtype - and at a time we want to display it in a normal date type....
    Its formatted as this: '2007-02-20T09:30:47.0Z' (Zero 0) - I guess it means no timezone in some ISO 86* standard
    select TO_date('2007-02-20T09:30:47.0Z','YYYY-MM-DD"T"HH24:MI:SS.??????') from dual;
    I have trie to find a format for reading it ... do you have an idea?
    regards
    Mette

    Sorry, forgot to say that some of the dates in the XML field is in this format
    '2007-02-20T09:30:47+100 ...... (yyyy-mm-dd"T"hh:mi:ssstzhtzm)
    /Mette

  • How to change date format for xml insert to a view

    We want to accept more than one data format in an XML insert using DBMS_XMLSave.insertXML(insCtx,xmlDoc);
    The two formats are
    6/7/2004 10:47:21 - This is working
    2004-06-08-04:00 - This gives the error
    java.text.ParseException: Unparseable date: "2004-06-08-04:00"'

    Make the column datatype VARCHAR2

  • Independently configure date format for XML/JSON serialization

    How do I configure the date format independently for each of my date fields?
    For example, let's say I have a CustomerOrder class with more than 1 java.util.Date fields in it.
    I need to be able to render like this:
    <customerOrder>
    <orderDate>2013-01-04T20:50:42.769Z</orderDate>
    <user>Bob</lastUpdateUser>
    <state>CO</state>
    <estShipDate>2013-01-04</estShipDate>
    </customerOrder>
    So one of the dates may not care about the hh:mm:ss.
    i.e. I cannot format every date the same way.
    Any ideas?
    This is my technology stack:
    - Tomcat 7
    - Jersey 1.16
    - Enunciate 1.26.2
    - Spring 3.1.2
    - Hibernate 4.1.7
    - JPA 2.0.3

    Otis,
    A "java.sql.Date" contains only a date, whereas a "java.sql.Timestamp" contains both date and time. So retrieve the data (from the database) as a "Timestamp" and not as a "Date".
    Perhaps if you'd care to post the relevant part of your code and show what you are getting and what you want to get, I may be able to help you further.
    Here's a small (uncompiled and untested) example:
    Connection conn = // However you get it.
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select sysdate from dual");
    if (rs.next()) {
      Timestamp ts = rs.getTimestamp(1);
    }Good Luck,
    Avi.

  • X format to XML conversion

    Hello;
    Any body knows how to develope a Java Application from any format into XML what the Java XML API need to be used.
    Consider for example LDIF to XML
    Regards
    mousamal

    don't build the XML tags directly because it forces you to deal with many things like encoding, etc...
    just directly build a DOM object, thinking in term of father and child nodes, nodes' names and node's value.
    then, when finished, serialize this DOM in an XML file or String or whatever stream you like.

  • Date format in XML Forms

    Hi all,
    I already have done my article using XML FORMS. I added into the article the date field that I needed. So, I would like to format the date output in Render List as “dd/mm/yyyy” instead of “mm/dd/yyyy”. It’s possible? Anyone knows how to do it?
    Thanks in advanced,
    Alcides Flach

    Hi,
    By adding in the Additional Metadata parameter the  entry "customFormat=dd.MM.yy", you'll force the display of this property to this format. Look at SAP note 816761 for more info about this.
    Patricio.

  • Date format for XML

    I have a Date object and I want it to be in the below format before I set it into a Calendar
    2009-10-09T17:00:00Z
    Here's my code
    Calendar cal = Calendar.getInstance();
    cal.setTime(new Date());
    How do I do that?
    Thanks

    user8742475 wrote:
    Here's my code
    String dateString = "2011-09-08T00:00:00-0700-07:00";
    SimpleDateFormat dfISO8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    Date dt= dfISO8601.parse(dateString);
    Calendar cal = Calendar.getInstance();
    cal.setTime(dt);
    customObject.setDStartDate(cal); //customObject is a WS object of Oracle CRM On Demand. I downloaded the WSDL and generated the proxy for it. It accepts a Calendar object
    Some possible solutions.
    1. It will also accept something else. I suggest using the SimpleDateFormat to produce a string and use that and nothing else.
    2. It won't accept anything else. Then you are left with the possibility that the WSDL is wrong (somehow) So you find a way to work around it which might include not using the WSDL at all.
    3. Depending on how setDStartDate() works you might be able to create a proxy Calendar class, your own implementation, specifically replacing toString() with a correct format based on SimpleDateFormat.

  • Issue with Date format - ABAP to XML

    Dear Users,
    We are currently facing an issue with the date formats in XML.
    We have a system (.Net), which has a webservice that we are calling for information from SAP. We created a Proxy class in SAP from the WSDL file and have attempted to use the method that gets us required information based on the Timestamp passed from SAP. However, the timestamp that the INPUT structure uses has a data element XSDDATETIME_Z.
    All we can send from SAP is a simple TIMESTAMP, but the .Net system doesn't accept it since it wants the timestamp in XML format i.e. <dd-mm-yyyy>T<hh:mm:ss>Z. SAP documentation says that the field should automatically do conversion from ABAP to XML format, but that doesn't happen. We don't want to build a string from Timestamp in the XML format and send it out since we might surely miss out on the different cases involved.
    Can anyone please suggest a way for us to send the date out in the required XML format?
    Many thanks!

    Hi Vijay,
    Look at the below sample code and it works fine, i guess there is something wrong in your code or conversion, post the actual code if you are still not able figure it out with the below example.
    DATA: l_xml_string TYPE string,
          l_dat_time TYPE xsddatetime_z.
    CALL FUNCTION 'CACS_DATE_GET_TIMESTAMP'
    EXPORTING
       I_DATE                         = sy-datum
       I_TIME                         = sy-uzeit
    IMPORTING
       E_TIMESTAMP                    = l_dat_time
    EXCEPTIONS
       DATE_NOT_FILLED_BUT_TIME       = 1
       DATE_HAS_NO_VALID_FORMAT       = 2
       OTHERS                         = 3.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL TRANSFORMATION id
      SOURCE root = l_dat_time
      RESULT XML l_xml_string.
    IF sy-subrc EQ 0.
    write: l_xml_string.
    ENDIF.
    Regards,
    Chen

  • Internal table data download to XML format

    Hello All,
    I have devloped one OOPS ALV report in that our requirement is on "SAVE" button the data of the report has to be downloaded in given XML format.Please check the format provided in Finnish language.The word "Value" specified as value which are coming in the ALV report against fields mentioned.
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!u2014Aromi list -->
    <!-- Copyright -->
    <!-- Edited with Visual Basic 6 -->
    <!-- Versio 1.0 -->
        <Tiedot Lahettaja="Value" Yhteyshlo=" Value"    
                    Yhteystieto=" Value " Asiakasnumero="">
           <Raaka-aine Nimi="" Ryhma=" Value ">
              <Tuotemerkki Nimi=" Value " Ean=" Value "
                                  Ykspakkauskoko="1" Ykspakkaustyyppi="KPL" almistaja="Value">
                 <Toimittajatiedot Tuotekoodi="10" Sopimustuote="Y" Myyntierakoko="5"
                                    Myyntieratyyppi="ME" Myyntierahinta="3,035" Hintapvm="value"
                  />
          </Tuotemerkki>
      </Raaka-aine>
    </Tiedot>
    Could anybody help how to download the report data into above format.
    Regards,
    Sachin

    Hi Sachin,
    I see the sample XML has field values embedded as XML element attributes.ie <Raaka-aine Ryhma=" Value ">. For such specific requirements:
    1. Loop through the table and Use iXML library functions to build the complete XML, element by element. Help - http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm
    2. You can create an XSLT Transformation that match the specific XML format,  and use CALL TRANSFORMATION to convert internal table to that specific XML format.
    Few Standard Function modules and class CL_XML_DOCUMENT may help for generic SAP XML conversions, where XML element names will be same as internal table field names. Not, sure if these can be used to generate specific XML formats.
    Thanks,
    Varun
    Edited by: Varun VS on Oct 25, 2011 7:48 AM

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

  • Problem with input data format - not "only" XML

    Hi Experts,
    I have problem with input data format.
    I get some data from JMS ( MQSeries) , but input format is not clear XML. 
    This is some like flat file with content of XMLu2026.
    Example:
    0000084202008-11-0511:37<?xml version="1.0" encoding="UTF-8"?>
    <Document xmlns="urn:xsd:test.01" xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance Sndr="0001" Rcvr="SP">
    ...content....
    </Document>000016750
    Problems in this file is :
    1. data before parser <? xml version="1.0"> -> 0000084202008-11-0511:37 
    2. data after last parser </Document> -> 000016750
    This data destroy XML format.
    Unfortunately XI is not one receiver of this files and we canu2019t change this file format in queue MQSeries ( before go to XI) .
    My goal is to get XML from this file:
    <?xml version="1.0" encoding="UTF-8"?>
    <Document xmlns="urn:xsd:test.01" xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance Sndr="0001" Rcvr="SP">
    ...content....
    </Document>
    My questions:
    1. Is any way or technique to delete this data 0000084202008-11-0511:37  in XI from this file ?
    2. Is any way to get only XML from this file ?
    Thanx .
    Regards,
    Seo

    Hi Buddy
    What is the XI adapter using?
    If you use inbound File adapter content conversion you could replace these values with none and then pass it to the scenario.
    Does that help?
    Regards
    cK

Maybe you are looking for

  • Lack of texts in hierarchy nodes and leafs for 0ORGUNIT

    Hello experts! We have the BCT hierarchy 0ORGUNIT in BW exporting his time-dependent structure from R/3. Now, for some leafes and some nodes above the leaf we have no texts just see the key. Has someone an idea what the problem could be? In R/3 we ha

  • How to create a sequence in Answers?

    Hi everyone, I want to know if it's possible to create a sequence in Answers and how. I have a Pivot table that I want to assign row numbers, but when I use RCOUNT(1) in a Dummy column I end up with 1 in all rows. This is the format of my pivot table

  • Ap3 on Second Monitor, "Alternate" on first??

    I have a two-monitor set-up. It seems that no matter on which monitor I put the Ap3 main window, the "Secondary Monitor" remains the same. I would like to have the Browser in Grid View on my second monitor, and the Viewer on my main monitor, so that

  • PDF to DVD and Audio MM

    Windows 7 and CS4 Production Premium, LR3 and Acrobat X Project "A": Acrobat allows me to generate pages with multimedia functions included. I can use Photoshop to convert the pages to TIFF. These pages then can become slides for a DVD presentation.

  • IE 8 as well mozilla  crashing when i try to open an oracle application

    hi everyone, i have application which has been deployed on production..itz working fine is almost all the computers..only 1-2 computers are giving me this problem.. computer descriptionz windows xp using IE 8 or mozilla 3.6.12 jnitiator 1.3.1.22 i ha