Datepublic Date(String s)
Deprecated. As of JDK version 1.1, replaced by DateFormat.parse(String s).

Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the parse(java.lang.String) method.Parameters:s - a string representation of the date.See Also: DateFormat, parse(java.lang.String)

解决方案 »

  1.   

    date的这个方法是不建议使用的淘汰的方法,换个其他的用你的字符串里包含时区就是CST,结果不对可能和这个有关
      

  2.   

    String str="Mon Jun 28 20:02:34 CST 2004";
    Date date=new Date(str);
    SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
    format.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
    String dateStr=format.format(date);
    System.out.print(dateStr) ;去试试吧,美女!