Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static String orderTimeFormat = "yyyyMMddHHmmss"; public static String getOrderTime(Date date) { return getFormatTime(date, orderTimeFormat); } public static String getFormatTime(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } }