Here you can find the source of utcTolocal(String utc)
public static String utcTolocal(String utc)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { static SimpleDateFormat dateFormatter = new SimpleDateFormat("E, MMMM d, yyyy HH:mm:ss, z"); public static String utcTolocal(String utc) { if (utc == null) return "NULL"; DateFormat utcFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); utcFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = null;//from w w w . j av a 2s . c o m try { date = utcFormat.parse(utc); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); return utc; } return formatDate(date); } public static String formatDate(Date d) { return dateFormatter.format(d); } }