Here you can find the source of formatToday()
public static String formatToday()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static String formatToday() { return format(new Date()); }/*from w w w . j av a2 s . c om*/ public static String format(Date date) { return FORMAT.format(date); } }