您的位置:首页 > 其它

UTC 转本地时间

2014-12-10 21:41 113 查看
String dateStr = "Wed Dec 10 00:00:00 UTC 0800 2014"; //Wed Dec 10 00:00:00 UTC 0800 2014

SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss 'UTC' yyyy",Locale.US);

try {
Date date = (Date) sdf.parse(dateStr);
String formatStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
System.out.println(formatStr);
} catch (ParseException e) {
e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: