rt   时间字符串是 : Wed May 09 12:39:37 +0800 2012

解决方案 »

  1.   

    你这个明显示Date类型的值。Date d = new Date();
    Calendar c = Calendar.getInstance();
    c.setTime(d);
    long l = c.getTimeInMillis();
    System.out.println(l);
      

  2.   

    long dd = Date.parse(s);
    这个方法虽然过时,但是用还是可以的!~
      

  3.   

    或者说用simpledateformat怎么转换
      

  4.   


    String time = "Wed May 09 12:39:37 +0800 2012";
        SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy");
        Date date = sdf.parse(time);
        System.out.println(date.getTime());
        System.out.println(sdf.format(new Date()));
      

  5.   

    public static void main(String[] args) {
    SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy",Locale.US);
    try {
    Date d = sdf.parse("Wed May 06 16:49:03 CST 2012");
    Calendar c = Calendar.getInstance();
    c.setTime(d);
    long l = c.getTimeInMillis();
    System.out.println(l);
    }
    catch (ParseException e) {
    e.printStackTrace();
    }
    }
      

  6.   

    Date d = sdf.parse("Wed May 09 12:39:37 +0800 2012");
    这个改一下,用你的字符串弄了半天,原来是SimpleDateFormat Locale没有老外的,默认是中国的。