Here you can find the source of getTodayTime()
public static String getTodayTime()
//package com.java2s; //License from project: Open Source License import java.text.FieldPosition; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTodayTime() { return getDate(new Date(), "yyyy.MM.dd HH:mm:ss"); }//from w w w .ja v a 2s . co m public static String getDate(Date pDate, String pFormat) { if (pDate == null) return ""; StringBuffer ret = new StringBuffer(); new SimpleDateFormat(pFormat).format(pDate, ret, new FieldPosition(0)); return ret.toString(); } }