Here you can find the source of today()
public static String today()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String DF_YMD = "yyyy-MM-dd"; public static String today() { return dateToString(now(), DF_YMD); }// www . j av a 2 s .com public static String dateToString(Date date, String format) { if (date == null) { return ""; } synchronized (date) { SimpleDateFormat df = new SimpleDateFormat(format); return df.format(date); } } public static String dateToString(Date date) { return dateToString(date, DF_YMD); } public static Date now() { return new Date(); } }