I am trying to convert a date in this format: “Fri Mar 1, 2013 4:30 PM” to a
timestamp value in this format: yyyy-mm-dd hh:mm:ss.
example:
String str = 'Fri Mar 1, 2013 4:30 PM' should output: "2013-01-14 23:59:59"
Here is what I’ve tried:
String string = "January 2, 2010";
Date date = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH).parse(string);
System.out.println(date);
This outputs: Sat Jan 02 00:00:00 GMT+05:30 2010
Thanks in Advance
Output: