get current date in dd-mm-yyyy format

Hitarth picture Hitarth · Oct 13, 2011 · Viewed 26.8k times · Source

how to get current date in DD-MM-YYYY format in BlackBerry

i have already tried the following, but it gives me output of 1318502493

long currentTime = System.currentTimeMillis() / 1000;

System.out.println("Current time in :" + currentTime);

Answer

Balconsky picture Balconsky · Oct 13, 2011
private String pattern = "dd-MM-yyyy";
String dateInString =new SimpleDateFormat(pattern).format(new Date());