Here you can find the source of getCurrentTime(String format)
public static String getCurrentTime(String format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentTime(String format) { long time = System.currentTimeMillis(); SimpleDateFormat dayTime = new SimpleDateFormat(format); String currentTime = dayTime.format(new Date(time)); return currentTime; }// ww w. j av a 2 s . c o m }