SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
Date newD = sdf.parse( yourDateString );

解决方案 »

  1.   

    import java.util.Date;
    import java.text.SimpleDateFormat;public class a{
    public static void main(String[] args){
    //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd",java.util.Locale.US);
    //String strDate="2003-07-30";
    //Date newD=sdf.format(strDate);
    String curDate="2003-03-23";
    Date newD=java.sql.Date.valueOf(curDate);
    System.out.println(newD.toString());
    }
    }
      

  2.   

    public static void main(String[] args)
      {
        java.util.Date ee=null;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         try {
           ee = sdf.parse("2003-06-23 17:50");
         }
         catch (Exception ex) {
         }
        
      }