Here you can find the source of getStrCurrentStrTime()
public static String getStrCurrentStrTime()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getStrCurrentStrTime() { return getCurrentStrTime("yyyyMMddHHmmss"); }//from w ww.j av a2 s . c om public static String getCurrentStrTime() { return getCurrentStrTime("yyyy-MM-dd HH:mm:ss"); } public static String getCurrentStrTime(String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); Date date = new Date(); String currentTime = sdf.format(date); return currentTime; } }