currentTimeMillis
public static long currentTimeMillis()Returns the current time in milliseconds. 
See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).Returns:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

解决方案 »

  1.   

    Date date = new Date();
    然后自己定格式输出!
      

  2.   

    public Date getdate() throws Exception {
    Date date=null;
            Calendar MyDate = Calendar.getInstance();
    MyDate.setTime(new java.util.Date());
            date=MyDate.getTime();
    return date;
    }
    最标准的,也是sun推荐的。
      

  3.   

    public static String GetTodayStr(String rDateFormat) {
            SimpleDateFormat lFormat;        lFormat =  new SimpleDateFormat(rDateFormat);
            gRtnStr = lFormat.format(new java.util.Date());        return gRtnStr;
        }
      

  4.   

    public String getdate_s() throws Exception {
    SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
    Calendar MyDate = Calendar.getInstance();
    MyDate.setTime(new java.util.Date());
    String adddate=df.format(MyDate.getTime()).substring(0,8);
    return adddate;
    }