import java.util.Date;
Date date = new Date(d3);这样可以? (未测试)

解决方案 »

  1.   

    我所知道的只能把一定格式的字符串转换成date类型(格式:yyyy-mm-dd)。
    用java.sql.Date.valueOf("yyyy-mm-dd")转换。
    它返回的是一个java.until.Date类型的对象。
      

  2.   

    yaray(雅睿,生活在别处) 你的我试了,可是转完后时间就自动给加了12小时,如:String d3="Tue Mar 23 14:12:51 CST 2004";
    System.out.println("d3 = "+d3);
    Date d4=new Date(d3);
    System.out.println("d4 = "+d4);结果:
    d3 = Tue Mar 23 14:12:51 CST 2004
    d4 = Wed Mar 24 04:12:51 CST 2004请问该如何是好,谢谢!
      

  3.   

    public 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)
      

  4.   

    DateFormat df=DateFormat.getDateInstance();
    try
    {
    tempdate=df.parse(last_time);
    }
    catch(Exception e){}
    转换的时候必须用日期格式话,累死我了