从一个数据库里读取时间字段
放在不同的服务器会显示不同的字符串
为什么呢,怎么转化成正常的时间?
两个不同的时间显示:
Wed Apr 15 17:04:38 CST 2009
Wed Apr 15 18:09:21 GMT+08:00 2009 
我查了资料是CST和GMT时间
大家有了解这个的吗
有函数可以之间转换成正常的时间吗?

解决方案 »

  1.   

    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    format.format(date);
      

  2.   


    试了报错
    import java.text.SimpleDateFormat;
    public class helloworld {
      public static void main(String args[])
      {
      String date="Wed Apr 15 18:09:21 GMT+08:00 2009";
      SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 
      System.out.println(format.format(date)); 
      }
    }