Here you can find the source of getCurrentTime(String format)
public static String getCurrentTime(String format)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentTime() { return getCurrentTime("yyyyMMddHHmmss"); }/* w w w. j a va 2 s. c o m*/ public static String getCurrentTime(String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(new Date()); } }