Here you can find the source of getTimeText(Long oldTime)
public static String getTimeText(Long oldTime)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public final static String TimeFormat = "yyyyMMddHHmmss"; public final static String DisplayDateFormat = "yyyy-MM-dd"; public final static String DisplayTimeFormat = "yyyy-MM-dd HH:mm:ss"; public static String getTimeText(Long oldTime) { Date old = parseDate(oldTime, TimeFormat); return formatTime(old); }//from ww w . j a v a 2 s. c o m public static Date parseDate(Long date, String format) { if (date == null) { return null; } SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA); try { return simpleDateFormat.parse(date + ""); } catch (ParseException e) { return null; } } public static Date parseDate(String date, String format) { if (date == null) { return null; } SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA); try { return simpleDateFormat.parse(date + ""); } catch (ParseException e) { return null; } } public static String formatTime(Date date) { return formatDate(date, DisplayTimeFormat); } public static String formatDate(Date date, String format) { if (date == null) { return ""; } SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA); return simpleDateFormat.format(date); } public static String formatDate(Date date) { return formatDate(date, DisplayDateFormat); } }