In our project I have faced a problem that is
Date date = new Date();
is converted to string
String dateToString = date.toString();
Again I want to convert same string (dateToString) as util date.
Any Solution?
Some Code Snippet:
Date todayDate = new Date();
String dateToString = todayDate.toString();
System.out.println(dateToString);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM hh:mm a YYYY");
Date stringToDate = new Date("05/26/2016");
System.out.println(stringToDate);
Output is: Thu May 26 18:12:58 IST 2016 Thu May 26 00:00:00 IST 2016 Here second output instead of 0's I need exact time. That's it.