请问怎么把这样的时间格式Thu, 23 Jun 2011 07:01:00 +0800 转化成:2011-06-23 09:20:17 
这样的时间格式~?

解决方案 »

  1.   

    Calendar now = Calendar.getInstance();
    Date d = now.getTime();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    System.out.println(sdf.format(d));接分
      

  2.   

    public static Date getDate() {
    String string = "";
    Date date = null;
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    try 
    {
    string = df.format(new Date());
    date = df.parse(string);

    catch (java.text.ParseException e) 
    {
    e.printStackTrace();
    }

    return date;
    }这样就可以的。
      

  3.   


    public static String getDate(String strTime) {
    Calendar now = Calendar.getInstance();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            try {
             strTime = df.format(new Date(strTime));
            } 
            catch (Exception e){
                e.printStackTrace();
            }
            return strTime;
        }这样子可以了~~~