I have a piece of code as below for date format conversion.
DateFormat formatter1 ;
DateFormat formatter2 ;
Date date = new Date();
formatter1 = new SimpleDateFormat("yyyy-mm-dd");
date = formatter1.parse("1952-12-10");
System.out.println("before format, date is " + date);
formatter2 = new SimpleDateFormat("dd-MMM-yy");
System.out.println("after format, date is " +formatter2.format(date));
I would like to change 1952-12-10 become 10-DEC-52, however, I am getting below output:
before format, date is Thu Jan 10 00:12:00 MYT 1952
after format, date is 10-Jan-52
This topic is now closed. New replies are no longer allowed.