Here you can find the source of convertStandardDateTime(String time)
public static String convertStandardDateTime(String time)
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.regex.Matcher; import java.util.regex.Pattern; import android.widget.TextView; public class Main{ public static String convertStandardDateTime(String time) { String standardResult = ""; try {/*from w ww . j a v a 2s .co m*/ time = time + "000"; long tmpTime = Long.parseLong(time); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); standardResult = sdf.format(new Date(tmpTime)); } catch (Exception e) { LogUtil.e("", e.getMessage()); } return standardResult; } private static String format(int x) { String s = "" + x; if (s.length() == 1) s = "0" + s; return s; } }