Date Parse Problem

I am looking to parse a string to a date object. I appreciate if someone can provide me a hint on this.
Below is the code:
String dateInStr = "Mon Mar 03 00:00:00 PST 2008";
try{
   DateFormat dateFormat = DateFormat.getDateInstance();
   Date dateObj = dateFormat.parse(dateInStr);
}catch (java.text.ParseException pEx) {
   pEx.printStackTrace();
}When I execute the above code, it gives me the following exception:
java.text.ParseException: Unparseable date: "Mon Mar 03 00:00:00 PST 2008"
     at java.text.DateFormat.parse(DateFormat.java:335)
     at backingbeans.AdvanceSearchProcessBean.populateFromSearchCriteria(AdvanceSearchProcessBean.java:1903)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
     at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
     at javax.faces.component.UICommand.broadcast(UICommand.java:312)
     at javax.faces.component.UIData.broadcast(UIData.java:657)
     at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
     at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
     at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:329)
     at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
     at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
     at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:223)
     at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
     at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
     at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
     at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
     at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
     at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
     at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
     at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
     at webutil.AccessLogger.doFilter(AccessLogger.java:133)
     at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
     at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3243)
     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
     at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
     at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2003)
     at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1909)
     at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)
     at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
     at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

Hmmm... I've got this to work using SimpleDateFormat instead of DateFormat.
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
Date dateObj = dateFormat.parse(dateInStr);
It's still a good idea to use the DateFormat interface, even if this is "correct".
I'd also recommend setting lenient to false. That way "31-Feb-2008" will throw an exception.
DateFormat dateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
dateFormat.setLenient(false);
Date dateObj = dateFormat.parse(dateInStr);The reason your original code didn't work is the default instance doesn't assume the parse string that you're using.
%

Similar Messages

  • Date parsing problem inside java

    Hi,
    I'm passing a date string in format yyyy-MM-dd and trying to convert into a date value using below code by parsing the string. But, interestingly the output that i'm getting from dateVal is coming as - Tue Apr 17 00:00:00 GMT 2012 instead of 2012-04-17
    Not able to understand why so.
    String s1 = "2012-04-17";
    SimpleDateFormat outFmt = new SimpleDateFormat("yyyy-MM-dd");
    Date dateVal = outFmt.parse(s1);
    Please help.
    Regards,
    prodyut

    927428 wrote:
    String statement="select * from TIMINGTABLE WHERE COUNTRY = 'USA' AND ";
    statement=statement+"RE_DATE >= '"+dateVal+"'" ;
    df.format(dateVal) // will give you "2012-04-17"FYI : Use tags in start and end of your codes to post codes in this forum                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Date parsing problem

    Hello!
    I am trying to parse stock-csv data from finance.yahoo.com.
    One line looks like this one:
    13-May-05,95.00,96.30,94.10,96.19,34627,87.50
    I extracted the date "13-May-05" and now I want to parse it.
    I tried:
    x = "13-May-05";
    - DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM,Locale.US);
    df.parse(x);
    - DateFormat df = new SimpleDateFormat("d-MMM-yy");
    df.parse(x);
    Both things did not work ("Unparseable date: "13-May-05"").
    Can someone see what's wrong?
    Thank you,

    yeah,, true, but there also seem to be some here
    otherwise (many times I found a better solution on my
    own,, but I usually go late at night.) At any rate,
    the parsing is basically what I said, only my system
    is-if it don't work, hard code it. It's stupidity at
    its finest, and total lack of confidence.
    hey-you guys really should look into what I posted on
    the 'skins' post--you would find it interesting-and
    also give you insight into finding out about java and
    ms-and why ms actually hates java-including why they
    made their own vm for java, and why they developed a
    java-like VB language, called VJ++, for their
    VisualStudio, in an attempt to drive java programmers
    from here to there. (unsuccessfully so far)Dude, I have no idea what you're saying, but pass me the bong and the Doritos.

  • Date parse error while importing users from OIM to OIA (SRM 5.0.3)

    Hi All,
    Env Details:
    OIA (SRM 5.0.3), Weblogic and Oracle 10g DB
    We have integrated OIM to OIA with extended attributes mapping by modifying iam-context.xml file to load users. Its done successfully. But when we map "Date" related attribute, its giving "Date Parsing error" and its not loading the users.
    We have tried loading users using flatFile mechanism, its also giving same result.
    Please suggest me. Thanks in Advance !!!
    Regards,
    Ravi G.

    Hi,
    Its a problem with OOB's OIMIAMSolution.class file, which is called while importing users from OIM. It used DateParse () conversion method only for all attributes which OIA attributes' name is ends with "Date". It defined, the conversion of date from (yyyy-MM-dd). So its expecting the input value should be in defined format(yyyy-MM-dd), if not, it gives a parse error.
    We found work around for this as follows,
    We have used other related OIA attribute which name ends other than "Date" string.
    Thanks,
    Ravi G.

  • Customer Data Parser

    Hi everyone,
    I'm trying to execute a CDP process but I get this error:
    02070E ERROR: Missing required field names in the input DDL. Occurred in Customer Data Parser - (CCDParser::CheckInputFieldNames).
    Does anyone knows what the problem could be?
    Thanks!

    This is best accomplished in the data reconstructor. The customer data parser willl break apart the house number, street name and all the addition address information into their own buckets. Then use the data reconstructor to rebuild the address, taking only the parts you need.
    Keep in mind that the additional information is crucial for correct delivery and postal discounts. You may want to think about the long-term uses of this data before you strip that information out.
    Steve Sarsfield

  • 3D data parsing error in Adobe Reader X 10.1.2

    Hello,
    I'm getting the annoying (and once fixed in version 9) 3D data parsing error with reader X 10.1.2 (on Windows 7 64bit), reading files that used to have no issues with previous versions (Italian locale). Anyone is having the same problem - or is able to give some suggestions? I've already tried to repair the installation, with no result. Any comment is greatly appreciated - this issue is causing major problems.
    Best regards,
    SV

    Hello,
    unfortunately it's a reserved document. I'll try to reproduce the issue with a different design and, if possible, I'll post a link to it.
    Thank you!
    Best regards,
    SV

  • 3D PDFs in Adobe Reader - "3D Data Parsing Error"

    Hi,
    I have just updated my adobe reader to 9.4.2 and I am regreting it already.  I use 3D PDFs on a regular basis and the ones I have that worked perfectly fine in 9.4.1 now do not work.  They come up with:
    "A 3D Data Parsing Error has occured"
    Does anyone know why this happens and particularly how to fix it, preferablly without going back to the older version of adobe reader.
    Many thanks.

    hey mark,
    i've got the same problem after updating to 9.402 this message appears and i cannot open the 3d scene.
    I found this (http://forums.adobe.com/message/2537356#2537356) thread and this link in it (http://communities.bentley.com/communities/everything_else_community/f/289/p/47047/106414. aspx#106414).
    hope that these can help you.
    regards frank

  • WIJ 20002 xml Parser Problem - Rich Client

    Hi,
    I have a problem with the rich client on a new installation:
    Business Objects Enterprise XI 3.1 SP3 on Windows 2008 Standard.
    If I connect with the rich client "import document"is disabled.
    if I try to create a new document from the rich client it returns the error below (I used the rich client on two workstations):
    WIJ 20002
    Version: null
    Analisi dello stack:
    java.lang.RuntimeException: java.lang.RuntimeException: XML parser problem:
    XMLJaxpParser.parse(): Element type "ABOUT_Patentnumbers" must be followed by either attribute specification, ">" or "/>".
    at com.businessobjects.wp.xml.jaxp.XMLJaxpParser.parse (Unknown Source)
    at.com.businessobjects.webi.richclient.XMLviaOccaRC.getServerConfiguration (Unknown Source)
    Have you any solution?

    The fixpack 3.5 client resolves the problem.

  • Report query parsing problem

    I didn't find any report of this problem...
    Using APEX 3.0.1.00.07, I have a report of type "SQL Query (PL/SQL function body returning SQL query)" with the "Use Generic Column Names (parse query at runtime only)" radio button selected.
    When the region source contains the string "ORDER BY" in any form that I've tried (even in a comment), attempting to save the region fails with "Your query can't include an "ORDER BY" clause when having column heading sorting enabled."
    I do indeed have column sorting enabled on certain columns, but I don't see how that is relevant under these circumstances since the query produced at runtime does not have an ORDER BY clause.
    Am I overlooking something or is this a parsing problem?
    Rodney

    Rodney,
    It's just checking for order by being included in your query, and if so and you have column heading sorting enabled, it's raising this error because you can't have both (even if it's commented out).
    Regards,
    Marc

  • Date popup problem in APEX 3.1

    Hi
    I have a date picker (DD-MM-YYYY HH24:MI) and after upgrading to APEX 3.1 from APEX 3.0.1 the popup window height is too small.
    The end user is having to resize the window to click on the OK button.
    Is there a file I can edit to increase the height, couldnt find it in templates/themes.
    Regards
    Adam

    Hi Adam,
    This is a bug in APEX 3.1. It was discussed here:
    Apex 3.1 Upgrade Issue - dba_lock and date picker display
    and here:
    Date Picker problem in Apex 3.1
    I'll let Carl investigate and provide an official response and recommendation. Although I know where this problem is occurring.
    The size of the popup calendar window is hard-wired in the file apex/images/javascript/apex_3_1.js. In APEX 3.0, the size of the popup window was determined programatically at runtime and was a function of the date format, if it included a time component or not.
    The uncompressed, readable version of this same file is in apex/images/javascript/uncompressed/apex_3_1.js. Look for p_DatePicker and you'll see what I'm talking about. You'll see the height is hard-wired to 210 and width to 258. In APEX 3.0, the height was set to 255 if the date format contained a time component.
    So my suggestion, until Carl provides an official response, is to look for '210' in apex/images/javascript/apex_3_1.js and change this to 255. Granted, all calendar popup windows will be this big, but it won't put as great a burden on the end-user.
    I hope this helps.
    Joel

  • ORA-01403: no data found Problem when using AUTOMATIC ROW FETCH to populate

    ORA-01403: no data found Problem when using AUTOMATIC ROW FETCH to populate a form.
    1) Created a FORM on EMP using the wizards. This creates an AUTOMATIC ROW FETCH
    TABLE NAME - EMP
    Item Containing PRIMARY KEY - P2099_EMPNO
    Primary key column - EMPNO
    By default the automatic fetch has a ‘Process Error Message’ of ‘Unable to fetch row.’
    2) Created a HTML region. Within this region add
    text item P2099_FIND_EMPNO
    Button GET_EMP to submit
    Branch Modified the conditional branch created during button creation to set P2099_EMPNO with &P2099_FIND_EMPNO.
    If I then run the page, enter an existing employee number into P2099_EMPNO and press the GET_EMP button the form is populated correctly. But if I enter an employee that does not exist then I get the oracle error ORA-01403: no data found and no form displayed but a message at the top of the page ‘Action Processed’.I was expecting a blank form to be displayed with the message ‘Unable to fetch row.’
    I can work around this by making the automated fetch conditional so that it checks the row exists first. Modify the Fetch row from EMP automated fetch so that it is conditional
    EXIST (SQL query returns at least one row)
    select 'x'
    from EMP
    where EMPNO = :P2099_EMPNO
    But this means that when the employee exists I must be fetching from the DB twice, once for the condition and then again for the actual row fetch.
    Rather than the above work around is there something I can change so I don’t get the Oracle error? I’m now wondering if the automatic row fetch is only supposed to be used when linking a report to a form and that I should be writing the fetch process manually. The reason I haven’t at the moment is I’m trying to stick with the automatic wizard generation as much as I can.
    Any ideas?
    Thanks Pete

    Hi Mike,
    I've tried doing that but it doesn't seem to make any difference. If I turn debug on it shows below.
    0.05: Computation point: AFTER_HEADER
    0.05: Processing point: AFTER_HEADER
    0.05: ...Process "Fetch Row from EMP": DML_FETCH_ROW (AFTER_HEADER) F|#OWNER#:EMP:P2099_EMPNO:EMPNO
    0.05: Show ERROR page...
    0.05: Performing rollback...
    0.05: Processing point: AFTER_ERROR_HEADER
    I don't really wan't the error page, either nothing with the form not being populated or a message at the top of the page.
    Thanks Pete

  • Report 6i Arabic Date alignment problem in Windows 7

    Hi
    We have 6i Forms and Report and wanna run in windows 7. But we found arabic Date disaplay problem in reports. As you know arabic writting from right. But date display like 21/10/1431 and I wanna like 1431/10//21.
    I tried from regional setting and change date format from report. but this is problem from system it self,
    not accept right alignment. Even I install left to right patch (KB979643-x86).
    Please Help
    Thanks

    Like others have said you need to run the bootcamp installer to install the drivers.
    The time issue was a constant annoyance rebooting with OSX and my old XP bootcamp setup but it's gone with Windows 7 once you set your time to UTC format in the date and time properties instead of local time which OSX uses and XP couldn't support.

  • SAX parser problem in JDK1.5

    I have parse the xml file using SAX in jdk1.5 environment. During the parsing, it missed the some text content.
    for example
    <employeeid>
    <empid>1001</empid>
    <empid>1002</empid>
    </employeeid>
    If i have parse the above xml file using SAX in jdk1.5 environment. The output is
    1001
    100
    during the parsing , SAX parser misses digit of 2.
    if i have parse the above xml file using SAX in jdk1.4 environment , it is working fine.
    what is the problem in jdk1.5
    please help
    bala

    What I expect the problem to be was discussed recently in a topic titled "SAX Parser Problems" that was started on March 14 at 6:59 AM by JackoBS.
    Read that and see if it fixes your problem. If so, it is not a JDK1.5 problem, but a user error.
    Dave Patterson

  • Flash Builder 4 Beta 2 ---- Data Management Problem

    Flash Builder 4 Beta 2 ---- Data Management Problem
    I have a simple datagrid, a PHP service and a MySQL database. When I run the code I get multiple(7) records returned to the datagrid.  Once I enable Data Management and run the exact same code, I only get 1  record returned.
    Is there a setting in Data Management that affects the number of records returned?
    Here is the MXML code I am testing. 
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768" xmlns:carasgndataphp="services.carasgndataphp.*">
          <fx:Script>
                <![CDATA[
                      import mx.controls.Alert;
                      import mx.events.FlexEvent;
                      var inptdata:String = "1";
                      protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                            getAsgnDataResult.token = carAsgnDataPHP.getAsgnData(inptdata);
                ]]>
          </fx:Script>
          <fx:Declarations>
                <s:CallResponder id="getAsgnDataResult"/>
                <carasgndataphp:CarAsgnDataPHP id="carAsgnDataPHP" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
                <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
          <mx:DataGrid x="115" y="91" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getAsgnDataResult.lastResult}" width="558" height="298">
                <mx:columns>
                      <mx:DataGridColumn headerText="A" dataField="numAsgn"/>
                      <mx:DataGridColumn headerText="T" dataField="numTopic"/>
                      <mx:DataGridColumn headerText="U" dataField="numUnit"/>
                      <mx:DataGridColumn headerText="P" dataField="numProblem"/>
                      <mx:DataGridColumn headerText="TP" dataField="PType"/>
                      <mx:DataGridColumn headerText="P" dataField="numSeqPresent"/>
                      <mx:DataGridColumn headerText="F" dataField="numSeqFeedback"/>
                      <mx:DataGridColumn headerText="D" dataField="numDelay"/>
                      <mx:DataGridColumn headerText="ID" dataField="idAsgnData"/>
                      <mx:DataGridColumn headerText="IDP" dataField="idProblem"/>
                </mx:columns>
          </mx:DataGrid>
    </s:Application>

    Hello,
    Data Mangement expects unique values for id property.This issue may occur when you select 'Identity' property in Data Mangement wizard which is not unique in the Table.For eg:, you have selected 'name' field as identity property. And your MySQL database table has multiple rows with identical values for 'name' column.
    Can you verify if you have similar setup?
    Thanks,
    Radhakrishna

  • AS3 Data Coercion Problem

    AS3 Data Coercion Problem
    From PHP server RemoteObject AMF3 serialization, I receive a
    photo object per below into my Flex client:
    package WPhoto {
    [Bindable]
    [RemoteClass(alias="WPhoto.PhotoObj")]
    public class PhotoObj {
    public var photo:*;
    public var photoWidth:int;
    public var photoHeight:int;
    The above 'photo' property String of a one-byte (UTF-8)
    '.jpg' photo data. Due to PHP's rather limited set of primitive
    data types this is the best I can do per returning photo data to
    the Flex client. (Extreme tries at PHP data structure chicanery
    hasn't worked for me.)
    I need photo property in a DisplayObject format such that I
    can render photo as a child of my App's DisplayObject. The AS3
    Loader class performs this task, when sourced from an AS3
    ByteArray.
    o Loader.loadBytes(bytes:ByteArray, context:LoaderContext =
    null):void
    Loads from binary data stored in a ByteArray object.
    My dilemma is "how to" convert a UTF-8 string of photo data
    into a ByteArray. I've been through the ByteArray.writeXXX() class
    methods without finding anything close to meeting my requirements.
    AS3 String readers expect UTF-16 data, so reading AS3 string
    reading is not a solution. AS3 has no Byte data type, accordingly
    reading my photo data UTF-8 string with a "for loop" into a AS3
    UTF-16 string, or whatever, is not viable. Is there a single-byte
    reader to 'whatever' writer I'm not aware of?
    If I was sourcing photos from a Java based server, my photo
    rendering dilemma would be over. The server to client packets would
    be "java.lang.Byte[]" => flash.utils.ByteArray and voilà we
    could easily and directly render photos via the Loader.loadBytes()
    method.
    I can tentatively extend one of the AS3 ByteArray class write
    methods if I thought there was a way to read UTF-8 streams. Before
    digging down into the ByteArray class on a feasibility basis, I
    thought it first best to ask around the experts per 1) can
    ByteArray be extended for my requirement, or 2) is there a better
    way to approach this, which I have not thought of?
    Pete Mackie
    Seaquest Software
    Adobe Community Expert - Flex

    Hi,
    Thanks for the quick reply.
    I simply don't get it.
    I have a root class which adds two different children of
    different classes. One child dispatched an event, and the other is
    supposed to get it. Both of the are now supposed to be in the
    instance hirrarchy, or am I wrong?
    Logically, I'd figure this should work smooth and simple
    without any need for any looping or such.
    Right now, the root class can recieve the event dispatched by
    child1, but I can't make child2 recieve any event dispatched by
    either the root or child1.
    I'd appreciate if you could show me the way...
    thanks again,
    EZ42

Maybe you are looking for

  • What's the 0800 number for apple? I can't find it.

    I need to phone apple to talk to them about my phone but I can't find their number anywhere.

  • Vendor enterprise services

    Hello, I'm looking for an entreprise service which returns the basic data or complete data of one or several customer/s in ERP(i.e. I need the information of customer with ID = 0000000025) or i.e. I need all data of all my customers, ID = *). I found

  • Change search options to FILE NAME only

    Is there a way to change the search options to always search for FILE NAME only? I don't know who'd saech for contents every time, that would seem like a last resort if you couldn't find what you are originally looking for and forgot the file name. W

  • Oracle Database migration to Exadata

    Dear Folks, I have a requirement to migrate our existing Oracle Database to Exadata Machine. Below is the source & destination details: Source: Oracle Database 11.1.0.6 Verson & Oracle DB 11.2.0.3 Non-Exadata Server Linux Enivrionment DB Size: 12TB D

  • Directory console not showing entries ???

    Hello, I just migrated around 15,000 entries into iPlanet Directory through the Import button. They went in no problem, and I could view them through the console. I then removed them using an ldif and import. I wnet back to view the entries and I not