Java tutorial
import java.text.DateFormat; import java.text.FieldPosition; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat(); StringBuffer sb = new StringBuffer(); formatter.format(new Date(), sb, new FieldPosition(DateFormat.DATE_FIELD)); System.out.println(sb); } }