在下从数据库取得时间变成 2019-01-25T01:30:00.000+0000 面向百度编程了,也没找到答案。
前端可以解决:
var dataee=new Date("2019-01-25T01:30:00.000+0000").toJSON();
console.log(dataee);
var date = new Date(+new Date(dataee)+8*3600*1000).toISOString().replace(/T/g,' ').replace(/\.[\d]{3}Z/,'');
//alert(date);
console.log("时间2==="+date);
然而我想后端把时间解决了:于是查资料发现:发现没有解决方法。于是我从toJSON()这个方法下手发现
于是解决方法:
SimpleDateFormat formatter = new SimpleDateFormat("YYYY-MM-DD'T'HH:mm:ss.sssZ");
Date date = formatter.parse("2019-01-25T01:30:00.000+0000");
System.out.println(date);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sDate=sdf.format(date);
System.out.println(sDate);