Here you can find the source of getNowDateTime()
public static String getNowDateTime()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**// w ww. j a v a 2s . co m * @Title : getNowDateTime * @return : String */ public static String getNowDateTime() { Date date = new Date(); return formatDate(date); } /** * @Title : formatDate * @param : @param d * @return : String */ public static String formatDate(Date d) { SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return s.format(d); } /** * @Title : formatDate * @param : @param s * @param : @param d * @return : String */ public static String formatDate(SimpleDateFormat s, Date d) { return s.format(d); } }