Java examples for Date Time:SimpleDateFormat
Use SimpleDateFormat to format date as 02/06/2005
import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String args[]){ Date date = new Date(); String DATE_FORMAT = "MM/dd/yyyy"; SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); /*w w w. j a va 2 s . c o m*/ System.out.println("Today is " + sdf.format(date) ); } }