Here you can find the source of getTimeString(Date utcDate)
public static String getTimeString(Date utcDate)
//package com.java2s; 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 getTimeString(String utcTimeString) { try {/*from www . java 2 s . c om*/ SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); Date date = sdf.parse(utcTimeString); sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); return sdf.format(date.getTime()); } catch (ParseException e) { e.printStackTrace(); return null; } } public static String getTimeString(Date utcDate) { if (utcDate.getTime() == 0) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA); return sdf.format(utcDate.getTime()); } }