hello I have date like..
String date="09:00 AM"
But I need 09:00:00
So I use following.
String date="09:00 AM"
SimpleDateFormat f1 = new SimpleDateFormat("hh:mm:ss");
Date d1= f1.parse(date);
But it give me parse exception.
Please help me to find this.
Thanks in advance.
That’s not the correct format for parsing that date, you need something like:
Once you have a date object, you can then use a different format to output it. The following code segment shows how:
This outputs:
as you would expect.