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.

Similar Messages

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

  • 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

  • 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

  • Invalid date format for 'Created' field in the getVersions web service Response.

    Hi all,
    I am trying to get all versions for selected document by calling getVersions method Versions.asmxweb service, but getting ‘Created’ date attribute value is in the format "29-05-2012 12:01"
    but I am expecting either one of the following date formats.
     1.      yyyy-MM-dd HH:mm:ss  or  yyyy-MM-ddTHH:mm:ssz
     2.      MM/dd/yyyy HH:mm a   (a means AM/PM)
     3.      MM/dd/yyyy
     4.      yyyyMMdd HH:mm:ss
    where do I need to change?
    what are all the formate will be support by SharePoint?
    please find attached response xml of getVersions call.
    <results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
        <list id="{6A6F6CD1-2E9C-44CC-B1F5-56G7JB5C8778}"/>
        <versioning enabled="1"/>
        <settings url="http://hbngjfgj47s20/reg/_layouts/LstSetng.aspx?List={7S6F6CD1-2E9C-44CC-B1F5-KO9J8Y7Y6H78}"/>
        <result version="@0.3" url="http://vmesxsrv47s20/register/Shared Documents/Parent/child/my_doc" created="29-05-2012 12:01" createdRaw="2014-12-02T12:46:02Z" createdBy="my_dom\agi_sharepoint"
    createdByName="AGI_Sharepoint" size="288" comments=""/>
        <result version="0.1" url="http://hbngjfgj47s20/register/_vti_history/1/Shared Documents/Parent/child/my_doc" created="29-05-2012 10:01" createdRaw="2014-12-02T10:55:18Z" createdBy="my_dom\my_sharepoint"
    createdByName="my_sharepoint" size="288" comments=""/>
        <result version="0.2" url="http://hbngjfgj47s20/register/_vti_history/2/Shared Documents/Parent/child/my_doc.txt" created="29-05-2012 11:01" createdRaw="2014-12-02T10:59:25Z" createdBy="my_dom\my_sharepoint"
    createdByName="my_sharepoint" size="288" comments=""/>
    </results>
    Kindly help me on this.

    Hi,
    According to your post, my understanding is that you want to change date format for ‘Created’ field in the getVersions web service.
    Per my knowledge, you can get the date format for ‘Created’ field as “MM/dd/yyyy HH:mm a”.
    For more information, you can refer to:
    Versions.GetVersions Method (Versions)
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

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

  • Supported date formats for sorting

    Can someone point me to a document describing the supported
    date formats for sorting? I mean, how should I format a date column
    in an XML dataset in order to have this column correctly sorted
    using the Spry framework?
    Thank you and sorry if the question is trivial.

    Thanks, what I have done for the moment as a temporary
    solution is to use the two date formats and have them both inside
    the one cell in the table (the column for the sortable date
    yyyy-mm-dd). In my CSS I have created a style for the first date
    that has it's visibility as hidden. That way it's sorting the Date1
    but only Date2 is being shown to the users as the other cells have
    more than one line of text it doesn't look too off centre.
    <div spry:region="ds2">
    <table width="662">
    <tr>
    <th width="127" class="eventhead"
    spry:sort="Date1">Date</th>
    <th width="151" class="eventhead"
    spry:sort="Type">Type</th>
    <th width="146" class="eventhead"
    spry:sort="Title">Title</th>
    <th width="189" class="eventhead"
    spry:sort="Venue">Venue</th>
    </tr>
    <tr spry:repeat="ds2" spry:setrow="ds2">
    <td height="53" class="event">{Date2}<span
    class="eventhide">{Date1}</span></td>
    <td class="event">{Type}</td>
    <td class="event">{Title}</td>
    <td class="event">{Venue}</td>
    </tr>
    </table>
    </div>
    </div>
    It seems to be working for the moment...

  • What should i put in Schme while creating Data server for XML

    I am new to XML and ODI also.
    I was trying to create a data server for XML technology.
    I don't know what should i specify as a schmea in JDBC URL.
    e.g. jdbc:snps:xml?f=../demo/xml/1/file.xml&ro=false&ldoc=true&case_sens=true&s=LEO_FIZ&dod=true
    here schema is LEO_FIZ, so my doubts is LEO_FIZ is a database schema or what ??
    Please help me out.

    The schema referred to here is going to be used by the XML driver for the instantiation of the temporary schema used for the xml data. It can be any name, I recommend you keep it short, as if you use an external database for the XML data instantiation it is used as a part of the "table" names.

  • Error of Creating Data Server for XML

    Hi all,
    When I want to create a new data server for XML in ODI, the error occur.
    error information:
    connection failed
    java.sql.SQLException: Unexpected token: EMP_TABLE in statement [create EMP_TABLE]
    My JDBC url is: jdbc:snps:xml?f=../demo/xml/MOP/MOPEMP.xml&rt=Export&ro=false&case_sens=true&s=EMP
    It seems that the error is caused by the schema "EMP". But when I changed the name of schema, the error still occur...
    Could you give me some advices about this?
    Thanks&Regards
    Yan

    Hi,
    Thans for your reply.
    This is the DTD for my xmldoc.
    <!ELEMENT Data (Department+)>
    <!ELEMENT EmployeeID (#PCDATA)>
    <!ATTLIST EmployeeID col (EMPID) #IMPLIED>
    <!ELEMENT Education (EmployeeID, Sequence, Dgree)>
    <!ATTLIST Education table NMTOKEN #IMPLIED>
    <!ELEMENT Employee (EmployeeName, EmployeeID, DepartmentID, Education*)>
    <!ATTLIST Employee table NMTOKEN #IMPLIED>
    <!ELEMENT EmployeeName (#PCDATA)>
    <!ATTLIST EmployeeName col NMTOKEN #IMPLIED>
    <!ELEMENT DepartName (#PCDATA)>
    <!ATTLIST DepartName col NMTOKEN #IMPLIED>
    <!ELEMENT Table (Column+)>
    <!ATTLIST Table importType NMTOKEN #IMPLIED>
    <!ATTLIST Table parentTable NMTOKEN #IMPLIED>
    <!ATTLIST Table tag NMTOKEN #IMPLIED>
    <!ATTLIST Table columns NMTOKEN #IMPLIED>
    <!ATTLIST Table name NMTOKEN #IMPLIED>
    <!ELEMENT DepartID (#PCDATA)>
    <!ATTLIST DepartID col NMTOKEN #IMPLIED>
    <!ELEMENT MetaData (Table+)>
    <!ELEMENT Sequence (#PCDATA)>
    <!ATTLIST Sequence col NMTOKEN #IMPLIED>
    <!ELEMENT Dgree (#PCDATA)>
    <!ATTLIST Dgree col NMTOKEN #IMPLIED>
    <!ELEMENT Export (MetaData, Data)>
    <!ELEMENT DepartmentID (#PCDATA)>
    <!ATTLIST DepartmentID col NMTOKEN #IMPLIED>
    <!ELEMENT Column (#PCDATA)>
    <!ATTLIST Column deleteKey NMTOKEN #IMPLIED>
    <!ATTLIST Column isKey NMTOKEN #IMPLIED>
    <!ELEMENT Department (DepartName, DepartID, Employee+)>
    <!ATTLIST Department table NMTOKEN #IMPLIED>
    Thanks again!
    Yan

  • Issue in creating data server for xml in ODI

    Hi,
    I have a XMl which has a size around 95 MB. When i tried to create data server in ODI for this xml file.
    I encounter below error,
    "oracle.odi.jdbc.datasource.ConnectionTimeoutException: A login timeout occured while connecting to the database
    at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:117)
    at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
    at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java:1125)
    at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.getLocalConnect(SnpsDialogTestConnet.java:163)
    at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.access$4(SnpsDialogTestConnet.java:159)
    at com.sunopsis.graphical.dialog.SnpsDialogTestConnet$4.doInBackground(SnpsDialogTestConnet.java:520)
    at com.sunopsis.graphical.dialog.SnpsDialogTestConnet$4.doInBackground(SnpsDialogTestConnet.java:1)
    at oracle.odi.ui.framework.AbsUIRunnableTask.run(AbsUIRunnableTask.java:258)
    at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:656)
    at java.lang.Thread.run(Thread.java:662)"
    Kindly let me know what should i do for resolving the error.
    Thanks and Regards,
    Ida Jebakirubai S.

    Yes Phil i am able to create a data server for xml files which are of smaller in size(in KB). And i can use the files in the interface as well.
    When i using this large file only i am getting this error.
    Please suggest.
    Thanks and Regards,
    Ida.

  • Date formats for SQL statements used by recordset object

    Hi,
    Date formatting appears to be quite problematic for Business One.  I did a forum search for date issues and I don't think I saw any of them with an "answered" status.  I have an issue with formatting a date for the creation of an SQL statement that the DI sends to SQL Server 2005.  I need to format a date so that the localization parameters don't matter for either the client machine or SQL Server's machine.  We don't have a problem as long as our machines are localized as USA.
    I have PL 22 and I have a form - ours - where I use the Today() function to fill a date field.  So this is a date that is not entered by the user.  The result of this function is consistent with the localization parameters on my machine.  We have two other date fields on the form where the user must type in the date. 
    As a test, I changed my machine to the UK parameters.  I then set up the language parameters of Business One for English(United Kingdom).  I changed the date format specifications in Business One so that its format is dd/mm/yy.  I then brought up the form and the field that is formatted by the above function arrived in the form's field as dd/mm/yy.  I then typed in the two other dates in the same format and added the record to the database.  The form's table is user-defined. 
    I dismissed the form then brought it back up loaded with the new record.  The date that was entered by the function appeared in USA format (mm/dd/yy).  The dates that were typed in appeared in the Business One format (dd/mm/yy).  This of course is not consistent.
    When I looked at what got into the database, the formats were the opposite.  Weird!  To make matters really confusing, I run an SQL statement within SQL Server Mgt Studio, and use the WHERE clause to filter on the date that was based on the function.  It didn’t matter what format I used for the WHERE clause, the record came up.  Does anyone have any idea about how I can ensure that I always use the correct date format for SQL statements passed by Business One to SQL Server regardless of where in the world the application is being run?
    Thanks,
    Mike

    Ian,
    Here's what I'm concerned about:  I’m using the date in a “WHERE” clause.
    Assume the date is Aug 3, 2007.
    "SELECT * FROM Table WHERE StartDate > ‘8/3/2007’"
    OR
    "SELECT * FROM Table WHERE StartDate > ‘3/8/2007’"
    If the client machine is set up as USA, the today function will provide the date as formatted in the first query.  If the database server is setup as let’s say the UK, I believe that SQL Server query parser will interpret the date as Mar 8, 2007.
    If the client machine is set up as UK, the today function will provide the date as formatted in the second query.  If the database server is setup as let’s say USA, I believe that SQL Server query parser will also interpret the date as Mar 8, 2007.
    In both cases it would be wrong.
    I know I could use the DATEPART function to get the three parts and this will make the code indifferent to the localization specs of the client machine.  I need to then be able to concatenate those date parts for the “WHERE” clause so that the localization specifications of the database server don’t matter.
    Thanks,
    Mike

  • Date Format for the input Variable

    Hi all,
    I got an issue with Date format we enter in the input variable screen for the BEx Analyzer.
    We have given a format of MM/DD/YYYY. But when the users accessed the report, it is not taking the format of the variable i.e MM/DD/YYYY but it is taking the format of the users system.
    If the user's system format is DD/MM/YYYY, it is accepting the input inthe same format only.
    Why this strange behaviour?
    My questions are
    Is the input for BEx system specific? or variable specific?
    Rgrds
    Kumar

    Hi,
    I think it is user specific... you can maintain the date format for user ....
    Go to SU01 transaction or.. Go to SYSTEM -> User Profile -> Own data
    Here in defaults tab you can see the date formet for user...
    Hope this helps...
    Thanks,
    Vikrant Mahajan

  • To accept all date formats for variables

    Hi,
    I am getting a vadidation message on refresh of a query on entering European date format in the selection criteria "Please enter value in permitted format for variable XXXX"
    I need date to accept all date formats for variables to execute query.
    Currently US date format has been accomodated, On entering European date format i get the above validation message.
    Please suggest how do i supress this validation message or any other thoughts on the same.
    If anyone experienced the same before or applied any notes plz send the SAP Note number for the same. I am currently on BW 3.5.
    Message was edited by:
            tyson m

    tyson,
    why dont you control the date display through the user creation / user details option - then your date entries should sort themselves out.
    Arun

  • How to change date format for prentation variable in Formula

    Hi experts.._
    I need to change date format for presentation variable in formula..
    my dashbord date prompt format: mm/dd/yyyy(i have created one presentation variable for this prompt: pv_date)
    now i need to show it as : month-dd-yyyy
    Thanks in advance
    Regards
    Frnds

    Hi Kishor...Thanks for reply...
    But i need to change my precentation variable date formt...
    i need to write one text like: 'Year to dd/month/yy' in one column formula..
    So how can i achieve it..

  • How to change date format for prentation variable

    Hi experts
    In my prompt the date format is MM/DD/YYYY . I have created one presentation variable for that but i want to use this in Formula as well in Title as: DD-MON-YY
    So how can i achieve it..
    Thanks in advance
    Regards
    Frnds

    Hi
    i think this can't be done through any code like oracle uses to_char, to_date function.
    Just follow this
    http://oraclebizint.wordpress.com/2007/12/19/oracle-bi-ee-101332-dates-dates-and-dates/
    With this, wherever you have this column, you will be getting this format dates..
    if you don't want in reports you can change it by mentioning the data format for that paricular column in report, but for the same column, if you want different format at different places (for prompts), you can't do that..

Maybe you are looking for

  • GR/IR Freight Clearing Account - GR & Invoice Verification

    Dear Gurus, I have made a PO for 1200 pcs unit price 69.20$.  (GR based IV).   (Valuation - Moving average price) Delivery costs - Freight (FRB1) - 1200$ I have splitted the PO quantity in to 3 different Inbound deliveries Inbound 1 - 400 pcs Inbound

  • Getting error in pck

    Hi all, I have configured sender file adapter in pck. When i checked communication channel monitoring am getting this error. "<b>Error: com.sap.aii.af.ra.ms.api.ConfigException: Failed to read channel configuration. Reason: Value with name NumberRetr

  • Trouble importing files because "files are already in Catalog"

    First off, I am using Elements Organizer (v 10).  There are certain folders that I can access in the Folders View but they are empty according to Organizer.  If I switch to Windows Explorer, these same folders have lots of images in them.  When I att

  • Windows 7 dident detect drivers

    Hi I installed windows 7 on macbook pro  with bootcamp/in macbook pro package not usb or dvd After install windows 7 i download & install bootcamp ver 3,3.1,3.2,3,3(new version) but it dident detect vga,sound,lan and wifi Please tellme where can i do

  • Memory Leak with BC4J

    We seem to be having a memory leak problem with our first BC4J application. Using the memory profiler in JDev(9.0.2.1) I have noticed that every time I check out an application module using Configuration.createRootApplicationModule() an oracle.jbo.co