Here you can find the source of getCurrentTime(String pattern)
public static String getCurrentTime(String pattern)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from www . j a v a 2 s . co m*/ * Get current time for pattern. * * @return */ public static String getCurrentTime(String pattern) { SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); return dateFormat.format(new Date()); } /** * Get current time for pattern. * * @return */ public static Date getCurrentTime() { return new Date(); } }