0

I want to use SimpleFormatMethod for date time like - 09/20/2016 10:10:10 PM. As I found in google, it could be like -

SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss.SSS ?");

but what should in place of ? which stands for AM/PM

Alpha
  • 13,320
  • 27
  • 96
  • 163
  • Possible duplicate of [Change date format in a Java string](http://stackoverflow.com/questions/4772425/change-date-format-in-a-java-string) – Tom Sep 16 '16 at 11:58

3 Answers3

0

SimpleDateFormat

SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss.SSS aaa");

Srinivasu
  • 1,215
  • 14
  • 32
0

As per SimpleDateFormat docs: "Am/pm marker" is letter a.

So in your case, you want:

SimpleDateFormat sdf  = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss.SSS a");
TeWu
  • 5,928
  • 2
  • 22
  • 36
0

SimpleDateFormat "Am/pm marker" is letter a. You can follow Documentation for more help

SimpleDateFormat sdf  = new SimpleDateFormat("MM/dd/yyyy kk:mm:ss.SSS aaa");
Farhan Yaseen
  • 2,507
  • 2
  • 22
  • 37