String s = "Tue Jul 17 12:52:10 GMT+08:00 2006";
SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
System.out.println(format.parse(s));这样怎么不行啊如果用 System.out.println(format.parse(s,new ParsePosition(0)));
结果返回Null 在网上找了好久也没办法 大家帮帮忙阿
SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy");
System.out.println(format.parse(s));这样怎么不行啊如果用 System.out.println(format.parse(s,new ParsePosition(0)));
结果返回Null 在网上找了好久也没办法 大家帮帮忙阿
我是这样做的 String s = "Tue Jul 17 12:52:10 GMT+08:00 2006";
SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy",Locale.US);
//设置时区和偏移量(毫秒)
SimpleTimeZone aZone = new SimpleTimeZone(3600000*8,"GMT+08:00");
format.setTimeZone(aZone);
Date date = format.parse(s);
System.out.println(date);
System.out.println(format.format(date));大家有没有别的什么好办法呢???讨论一下,晚上结贴