如题.急

解决方案 »

  1.   

    GregorianCalendar cal = new GregorianCalendar(); cal.setTime(new Date()); cal.add(Calendar.DATE, -7); System.out.println(cal.getTime());
      

  2.   

    Calendar c = Calendar.getInstance();
    c.add(Calendar.DAY_OF_MONTH,-7);//关键是这个7天前....
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    System.out.println(sdf.format(c.getTime()));
      

  3.   

    上面的对哟,只不过把SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");中的小写hh变成大写HH就可以表示成24小时制了。