Here you can find the source of getCurrentTimeString(String pattern)
public static String getCurrentTimeString(String pattern)
//package com.java2s; //License from project: Apache License import java.text.Format; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getCurrentTimeString() { Date now = Calendar.getInstance().getTime(); Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return formatter.format(now); }// ww w.j av a2 s. com public static String getCurrentTimeString(String pattern) { Date now = Calendar.getInstance().getTime(); Format formatter = new SimpleDateFormat(pattern); return formatter.format(now); } }