First, three-char months are to be represented by MMM
. Second, one-two digit hours are to be represented by h
. Third, Mar
seems to be English, you'll need to supply a Locale.ENGLISH
, else it won't work properly in machines with a different default locale.
The following works:
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd yyyy h:mm:ss:SSSa", Locale.ENGLISH);
System.out.println(sdf.parse("Mar 30 2010 5:27:40:140PM"));
Result (I'm at GMT-4 w/o DST):
Tue Mar 30 17:27:40 BOT 2010
Also see the java.text.SimpleDateFormat
javadoc.
Why you called it pdf
is beyond me, so I renamed it sdf
;)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…