Here you can find the source of getCurrTime()
public static String getCurrTime()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrTime() { Date now = new Date(); SimpleDateFormat outFormat = new SimpleDateFormat("yyyyMMddHHmmss"); String s = outFormat.format(now); return s; }//from w w w . j av a 2s .co m public static String format(Date date, String pattern) { if (date == null) { return ""; } SimpleDateFormat df = new SimpleDateFormat(pattern); return df.format(date); } }