java  receivedate 2002 06 04set
----------------------
public final void set(int year,
                      int month,
                      int date)
Sets the values for the fields year, month, and date. Previous values of other fields are retained. If this is not desired, call clear first.Parameters:year - the value used to set the YEAR time field.
month - the value used to set the MONTH time field. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DATE time field.
----month是从0开始算起的!

解决方案 »

  1.   

    SimpleDateFormat sd = new SimpleDateFormat("EEE");
        System.out.println(sd.format(new Date()));
      

  2.   

    如果是取系统时间,直接用new Date()获取即可,如下:
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
    String s = sdf.format(new Date());
    System.out.println(s);//输出
    如果按照你的方法要获得它的星期和月份
    需注意月是从1月到12月,对应数值0-11的,星期是从周日至周六算的,对应数值1-7
    仔细看看帮助文档吧
    当然还得注意你自己电脑上的时间是否正确.
      

  3.   

    取当前系统时间new Date()即可:
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
    String s = sdf.format(new Date());
    System.out.println(s);
    若按你的方法取星期和月,注意星期是从周日至周六,对应数值是1-7;月份是从1至12月,对应数值0-11
      

  4.   

    取当前系统时间new Date()即可:
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
    String s = sdf.format(new Date());
    System.out.println(s);
    若按你的方法取星期和月,注意星期是从周日至周六,对应数值是1-7;月份是从1至12月,对应数值0-11