我试过了,好用:
try{
TextField text1 = new TextField("2002年9月13日16点15分14秒");
        String theString = text1.getText();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日hh点mm分ss秒");
        ParsePosition ps = new ParsePosition(0);
        Date dateTime = sdf.parse(theString, ps);

解决方案 »

  1.   

    DateFormat是有一定格式的。
    try{
         TextField text1=new TextField("2002-9-13 16:15:14");
         String theString=text1.getText();
         DateFormat df=DateFormat.getDateTimeInstance();
         Date dateTime=df.parse(theString);
             }
    catch(ParseException e){
         e.printStackTrace ();
         text1.setText ("UnparseableYourData" + e.toString ());
          }
      

  2.   

    看看java api文档 这些东西很容易查到
      

  3.   

    shidu(十度) 的方法也对,用和寒兄说的都是用的默认的方法。
      

  4.   

    incompatibale types:found:java.text.DateFormat,required:java.text.SimpleDateFormat和
    exception java.text.ParseException is never thrown in the corresponding的两个错误,但是我已经:java.text.SimpleDateFormat;了