Studyon Minte9.com
Java SE




Format




package testexample; import java.util.*; import java.text.*; public class Test { public static void main(String[] args) { DateFormat today = new SimpleDateFormat("yyyy-MM-dd"); System.out.println(today.format(new Date())); // Output: 2013-01-21 String today2 = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); System.out.println(today2); // Output: 2013-01-21 } }
 


http://stackoverflow.com/questions/2942857/how-to-convert-current-date-into-string-in-java