Java. Text. parseexception: unparseable date

Source: Internet
Author: User

From: http://hi.baidu.com/%BE%A9%B3%C7%BD%AD%D1%A9/blog/item/5bc274dbec37fc2710df9b61.html

 

When you use Java to convert the string format to the date type, you can define a string d = "2010/05/19" by using the following statement:

 
Simpledateformat SDF = new simpledateformat ("yyyy/mm/dd hh: mm: SS"); string DDD = "2009/10/19 00:00:00"; try {date d = SDF. parse (DDD);} catch (parseexception e) {// todo auto-generated Catch Block E. printstacktrace ();}

Java. Text. parseexception: unparseable Date: "2009/10/19 00:00:00" is not thrown"
At java. Text. dateformat. parse (dateformat. Java: 337)
At com. Come. Dates. Main (dates. Java: 14)
Exception

However, an exception is reported when the string uses string startdate = request. getparameter ("startdate ").

Solution: 1: Date startreportdate = SDF. parse (startdate. tostring (); tostring does not understand why

Ii. Date start = (date) SDF.Parseobject(Startdate );

Yes

I have read the above questionsArticleNot solved

Appendix Oracle conversion solution

 
There are three types of to_char () functions: 1. to_char (char) is used to convert nchar, nvarchar2, clob, or nclob parameters to database character set strings. 2. to_char (date [, FMT] [, 'nlsparam']) is used to convert a date to a varchar2 string in the specified format. Because sysdate is a date, it is used to return the date and time of the current system, so it is correct to use to_char (sysdate, 'fmdd mouth yyyy. That is: Select to_char (sysdate, 'fmdd month yyyy') ddddd from dual; 3. to_char (Num [, FMT] [, 'nlsparam']) is used to convert numeric num to a varchar2 string in the specified format. The first parameter of to_date (char [, FMT] [, 'nlsparam']) must be a string in a specific format. 'Ddddd 'is obviously not.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.