得到的时间是“Thu Jun 06 1985 00:00:00 GMT+0800 (中国标准时间)” 这样的字符串 +1 ------Solutions------ “Thu Jun 06 1985 00:00:00 GMT+0800 (中国标准时间)”已经是字符串了,很难了,除非自己解析。 正确的做法应该是拿到时间对象,再用SimpleDateFormat ------Solutions------ 该回复于2012-02-22 11:42:53被版主删除 ------Solutions------ SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd"); format.format("这是是日期"); 出来的就是你想要的格式了。 ------Solutions------ new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss' GMT'Z' (中国标准时间)'",Locale.ENGLISH); ------Solutions------ 你看人家的需求了吗? 别误导人好吗? ------Solutions------ 该回复于2012-02-22 13:02:30被版主删除 ------Solutions------ csdn整天大姨妈 真2 ------Solutions------ import java.text.SimpleDateFormat; import java.util.Date; public class Test { /** * @param args */ public static void main(String[] args) { SimpleDateFormat formart = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date("Thu Jun 06 1985 00:00:00 GMT+0800"); System.out.println(formart.format(date)); } } 結果:1985-06-06 ------Solutions------ SimpleDateFormat formart = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date("Thu Jun 06 1985 00:00:00 GMT+0800"); System.out.println(formart.format(date)); ------Solutions------
------Solutions------ String str="Thu Jun 06 1985 00:00:00 GMT+0800 (中国标准时间)"; |
|