I have a problem with this small piece of code
SimpleDateFormat sf = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss"); String str = "2010-03-13 01:01:22"; Date date = sf.parse(str); SimpleDateFormat f = new SimpleDateFormat("d MMM yyyy hh:mm aaa"); System.out.println(" Date " + f.format(date));
Output:
Date 13 Jan 2010 01:01 AM
The code seems fine, but still I get the wrong month name. Please help !! Thanks.
source share