解决方案 »

  1.   

    Date date = new SimpleDateFormat("yyyyMMdd HH:mm:ss").parse("2014021213:30:32");
      

  2.   

    String strTime = "2014021213:30:32";
    Date dateTime = new SimpleDateFormat("yyyyMMddHH:mm:ss").parse(strTime);
      

  3.   

    public static void main(String[] args) throws ParseException {
    String str = "2014021213:30:32";
    String newStr=str.substring(0,8)+" "+str.substring(8,str.length());
    //打印重新拼装后的newStr
    System.out.println(newStr);
    //把组装后的newStr转换为date
    DateFormat df = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
    Date newDate=df.parse(newStr); }
      

  4.   

    如果日期是常规的yyyyMMdd格式,用楼上的方法即可!
      

  5.   

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = sdf.parse("2014021213:30:32");
    同样可是使用SimpleDateFormat类来实现只需要String date = sdf.format(new Date());就可以了
      

  6.   

    这个不行吗?我试了试可以啊
    这个可以啊,"yyyyMMdd HH:mm:ss"-->"yyyyMMddHH:mm:ss"就满足他的了。不要dd和HH之间的空格。
      

  7.   

    simpledateformat.parse(),simpledateformat.format()
    这两个方法一个解析,一个按你需要的格式输出