Here you can find the source of formattedDate()
public static String formattedDate()
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final DateFormat timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static String formattedDate() { return toTimestamp(new Date()); }//ww w . j a va 2 s . c o m public static String toTimestamp(Date d) { return timestampFormat.format(d); } }