如何取得2008年-7月-5日-8点-7分

解决方案 »

  1.   

    LZ是要那样的格式还是就是确定的值,确定的值就是个字符串
    格式的话
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy年-M月-d日-H点-m分");
    System.out.println(sdf.format(new Date()));
      

  2.   


    Calendar c = Calendar.getInstance();
    c.set(2008, 7 - 1, 5, 8, 7);
    Date d = c.getTime();
      

  3.   

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy年-M月-d日-H点-m分");
    System.out.println(sdf.format(new Date()));