I want my java program to take the system date format .
Ex: when i change the date format in the system from mm-dd-yy to yyyy-MM-dd.
I want my java program to pull the short date format from the system and display in my program.
Again if I change the system format to M/D/YY, my java program to display this.
I tried few options like ,
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat();
System.out.println(System.currentTimeMillis());
System.out.println(cal.getTime());
System.out.println( sdf.format(cal.getTime()) );
this always prints mm/dd/yy inspite of having yyyy-mm-dd format in the system.
Any help would be appreciated.