1

In java, how to write this date format?

Dec 17 2011 07:37:55:000PM
SimpleDateFormat sdf = new SimpleDateFormat("M W yyyy hh:mm:ss:SSSa"); // failed

I tried this format, it doesn't work.

Please help, thanks.

0

1 Answer 1

7

I think you just need to expand your Month format to 3 M's and the days char is d not W.

new SimpleDateFormat("MMM dd yyyy hh:mm:ss:SSSa");
                      ^^^ ^^

Check here for more information on date formats http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.