executing this piece of code:
SimpleDateFormat sdfIn = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
date = sdfIn.parse(value11);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SimpleDateFormat sdfOut = new SimpleDateFormat("MMM d, yyyy");
System.out.println(sdfOut.format( date ));
I an getting this output nov 23, 2005
instead of Nov 23, 2005
which would be much better.
Does anybody knows how to change it??
Thanks in advance
The exact strings that get generated depend on the locale you're in. If you just use
new SimpleDateFormat("MMM d, yyyy");
then the system default locale will be used. Your default locale probably renders the month as nov
rather than Nov
.
if you want a specific locale to be used, pass it in to the constructor, e.g.
new SimpleDateFormat("MMM d, yyyy", Locale.US);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With