Here you can find the source of getCurrentTimeString(String format)
public static String getCurrentTimeString(String format)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String getCurrentTimeString() { Date cal = new Date(); SimpleDateFormat newSDF = new SimpleDateFormat("HH:mm:ss"); String timeStr = newSDF.format(cal); return timeStr; }/* www .j a va2 s .co m*/ public static String getCurrentTimeString(String format) { Date cal = new Date(); SimpleDateFormat newSDF = new SimpleDateFormat(format); String timeStr = newSDF.format(cal); return timeStr; } }