格林尼治时间2016-10-15T00:00:00.000+08:00转Date


	public static void main(String[] args) throws ParseException {
		String oldDateStr = "2016-10-15T00:00:00.000+08:00";
		//此格式只有  jdk 1.7才支持  yyyy-MM-dd'T'HH:mm:ss.SSSXXX      
		
		 DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");  //yyyy-MM-dd'T'HH:mm:ss.SSSZ
		 Date date = df.parse(oldDateStr);
		 System.out.println(date);
		 
		 SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
		 System.out.println(df1.parse(date.toString()));
		 System.out.println(df1.format(date));
		 
		 DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		 System.out.println(df2.format(date));
	}


输出:

Sat Oct 15 00:00:00 CST 2016
Sat Oct 15 00:00:00 CST 2016
Sat Oct 15 00:00:00 +0800 2016
2016-10-15 00:00:00

参考链接:http://www.cnblogs.com/wudi521/p/5855680.html

你可能感兴趣的:(学习笔记)