Here you can find the source of getCurrentDate(String format)
public static String getCurrentDate(String format)
//package com.java2s; //License from project: Apache License public class Main { public static String getCurrentDate(String format) { if (format == null || format.isEmpty()) format = "yyyy.MM.dd'-'HH:mm:ss"; java.text.DateFormat dateFormat = new java.text.SimpleDateFormat(format); java.util.Date date = new java.util.Date(); String currDate = dateFormat.format(date); return currDate; }//from www.ja va2 s. co m }