Here you can find the source of today()
public static Date today()
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static final String DATE_FORMAT = "yyyy/MM/dd"; public static Date today() { try {//from w w w . j av a2 s . c om return new SimpleDateFormat(DATE_FORMAT).parse(formatDate(new Date())); } catch (ParseException e) { e.printStackTrace(); return null; } } public static String formatDate(Date d) { return format(d, DATE_FORMAT); } public static String format(Date d, String format) { return format(d, format, Locale.getDefault()); } public static String format(Date d, String format, Locale locale) { if (d == null) return ""; DateFormat df = new SimpleDateFormat(format, locale); return df.format(d); } }