Here you can find the source of formatyyyyMMddHHmmss(long time)
public static String formatyyyyMMddHHmmss(long time)
//package com.java2s; /*//from w w w . jav a 2s .co m * Copyright 2010 Mttang.com All right reserved. This software is the * confidential and proprietary information of Mttang.com ("Confidential * Information"). You shall not disclose such Confidential Information and shall * use it only in accordance with the terms of the license agreement you entered * into with Mttang.com. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { static final SimpleDateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static String formatyyyyMMddHHmmss(long time) { return yyyyMMddHHmmss.format(new java.util.Date(time)); } public static String formatyyyyMMddHHmmss(Date time) { if (time == null) { return ""; } try { return yyyyMMddHHmmss.format(time); } catch (Exception ex) { return ""; } } }