Timestamp ts=new Timestamp(System.currentTimeMillis());
这句代码出错了,提示说没有这个构造方法,但是我手上的API1.6明明就有这个构造方法啊,传参为long类型的System.currentTimeMillis();
还有一个已过时的构造方法,就不提了..我相信之前大家肯定用过类似以上的代码,但是现在编译都通不过,我用的是MyEclipse8.0 ,是不是这个有问题呢?不大可能吧?
这是为什么呢?

解决方案 »

  1.   

     public static String getSystemTime() {   
            TimeZone.setDefault(TimeZone.getTimeZone("GMT+8:00"));   
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",   
                    Locale.CHINA);   
            return sdf.format(Calendar.getInstance().getTimeInMillis());   
        }    Timestamp ts=Timestamp.valueOf(getSystemTime());
      

  2.   

    Timestamp ts=new Timestamp(System.currentTimeMillis());
    我试过了,没问题呀,可能是你引错包了。