Here you can find the source of getCurrentTime(String timeFormat)
public static String getCurrentTime(String timeFormat)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String getCurrentTime() { return getCurrentTime(null); }// w ww. j av a 2s . c o m public static String getCurrentTime(String timeFormat) { if (timeFormat == null) { timeFormat = "MM/dd/yyy hh:mm:ss"; } return new SimpleDateFormat(timeFormat).format(new Date()); } }