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.