How to convert String into DateFormat in java? -
I am working on Java. I have a I want to change it to How can I do this? Try this: string and I want to convert it to
date format. Please see the code line for more details.
string dateString = "4:16:06 pm";
date below:
date changed date = 2014-04-22 16:16 : 06.00
// Get the current date SimpleDateFormat DateFormat1 = new Simple Format ("yyyy-MM-dd") format; String A = Dateform 1 Format (new date ()); // Add a current date to your time string string dateString = a + "4:16:06 PM"; SimpleDetform FormatDormat2 = New SimpleDatormat ("YYA-MM-DD H: mm: SSA"); Try {// Pars it. It is the date object you date d = dateFormat2.parse (dateString); } Hold (ParseException pre) {ex.printStackTrace (); }
Comments
Post a Comment