![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLyFGdz9lbvNWavw1cldWYtl2Lc12bj5SZ5VGdp5SYklWetFWavw1LcpDc0RHaiojIsJye.png)
//日期输出格式
string targetformat = "yyyy-mm-dd hh:mm:ss";
//日期原始格式
string origformat = "yyyy-mm-dd't'hh:mm:ss.sssz";
string s = "1988-11-06t12:14:05.671+08:00";
//去掉时区部分的冒号
s = s.replaceall(":[^:]*$", "00");
system.out.println(s);
dateformat format = new simpledateformat(origformat);
date date = format.parse(s);
format = new simpledateformat(targetformat);
string datestring = format.format(date);
system.out.println(datestring);
转载:http://iamyida.iteye.com/blog/2207715