SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
Date date1 = sdf.parse("2011-10-01 00:00:00");
Date date2 = sdf.parse("2011-09-30 00:00:00");
System.out.println("t1:"+date1.getTime());
System.out.println("t2:"+date2.getTime());为何9月30号的长整形数值比10月1号的数值还大?
之前没注意过,,,

解决方案 »

  1.   

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
    月:MM
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
      

  2.   

    请将第一个 mm 改为 MM
      

  3.   

    兄弟  你的是有问题的,SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");你格式化的字符串写错了。MM应该要大些才是月份