Here you can find the source of currentDateAsString()
public static String currentDateAsString()
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String currentDateAsString() { return toString(Calendar.getInstance()); }/*from w ww .ja v a 2 s. c o m*/ public static String toString(Calendar c) { return getDateFormat().format(c.getTime()); } private static DateFormat getDateFormat() { DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); return formatter; } }