Here you can find the source of timeMillisToString(long timeMillis, String dateFormat)
public static String timeMillisToString(long timeMillis, String dateFormat)
//package com.java2s; /*/*from w ww . j a v a2 s. co m*/ * Title: TRS ?????? * Copyright: Copyright (c) 2004-2005, TRS?????????????. All rights reserved. * License: see the license file. * Company: TRS?????????????(www.trs.com.cn) * * Created on 2005-5-11 */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String timeMillisToString(long timeMillis) { return timeMillisToString(timeMillis, "yyyy-MM-dd HH:mm:ss"); } public static String timeMillisToString(long timeMillis, String dateFormat) { if ("".equals(dateFormat) || dateFormat == null) { return null; } try { return new SimpleDateFormat(dateFormat).format(new Date(timeMillis)); } catch (Exception e) { return null; } } }