Here you can find the source of getToday()
public static String getToday()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static final String DATE_PATTERN = "yyyy-MM-dd"; public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static String getToday() { return formatDate(new Date()); }/*from ww w.ja v a 2 s . c o m*/ public static String getToday(String pattern) { return formatDateTime(new Date(), pattern); } public static String formatDate(Date d) { return formatDateTime(d, DATE_PATTERN); } public static String formatDateTime(Date d) { return formatDateTime(d, DATETIME_PATTERN); } public static String formatDateTime(Date d, String pattern) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(d); } }