Here you can find the source of today()
public static Date today()
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String webFormat = "yyyy-MM-dd"; public static Date today() { return parse(format(new Date(), webFormat), webFormat); }/*w ww . ja v a2s . c om*/ public static Date parse(String s_date, String format) { if (s_date == null) return null; try { return new SimpleDateFormat(format).parse(s_date); } catch (ParseException e) { e.printStackTrace(); } return null; } public static String format(Date date, String format) { if (date == null) { return null; } return new SimpleDateFormat(format).format(date); } }