Java tutorial
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main { public static String convertUtc2Local(String utcTime) { String time = ""; if (utcTime != null) { // 2014-10-24T02:58:05.932Z SimpleDateFormat utcFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.CHINA); utcFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); Date gpsUTCDate = null; try { gpsUTCDate = utcFormatter.parse(utcTime); } catch (ParseException e) { e.printStackTrace(); } SimpleDateFormat localFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); localFormatter.setTimeZone(TimeZone.getDefault()); assert gpsUTCDate != null; time = localFormatter.format(gpsUTCDate.getTime()); } return time; } }