Here you can find the source of today()
public static String today()
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//w ww .ja v a 2 s . c o m * @return current date with respect to the format yyyy-MM-dd */ public static String today() { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); return dateFormat.format(date); } }