In my android application, I want to set the date and time in TextView. In that date value I have selected and stored as a String. Now I want to set the String date value and current time.
I tried the following code. It did displayed stored date value but the time as 12.00 AM. I want current time?
String lbl_date="02-Aug-2011";
Date dateObj = new Date(lbl_date);
SimpleDateFormat postFormater = new SimpleDateFormat("dd-MMM-yyyy hh:mm aa",Locale.ENGLISH);
String newDateStr = postFormater.format(dateObj);
txt_date_start.setText(newDateStr.toString());
output as: 02-Aug-2011 12:00 AM
Need: 02-Aug-2011 [current time]
1 Answer