How to get time from String (14-04-2021 18:04:87) ?
How to get only time from this String "14-04-2021 18:04:87" ?
I need output as 06:04 pm
How to get time from String (14-04-2021 18:04:87) ?
How to get only time from this String "14-04-2021 18:04:87" ?
I need output as 06:04 pm
You can use SimpleDateFormat
String dateString = "14-04-2021 18:04:87";
Date date = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").parse(dateString);
String result = new SimpleDateFormat("hh:mm aa").format(date);