Here you can find the source of getNow()
public static String getNow()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getNow() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date today = new Date(); return format.format(today); }//from w w w .j a va 2s . co m public static String getNow(String fmt) { SimpleDateFormat format = new SimpleDateFormat(fmt); Date today = new Date(); return format.format(today); } }