I am parsing a .vcs file and it just has the date-time in the below format. For example-The start date-time of the event is in the below format:
DTSTART:20000803T103000Z
Since I have this string I can easily find out the values of hour, mins, day, month , year etc. and display it easily in readable format. But I want to show AM and PM also with time. How can I do this? Which Android function can I use to get AM and PM from this string. Any help would be appreciated.
hour = StartDate.substring(9,11);
minutes= StartDate.substring(11,13);
hoursofday = Integer.parseInt(hour);
minutesofday = Integer.parseInt(minutes);
if(hourOfDay>12)
{
datehid.setText(String.valueOf(hourOfDay-12)+ ":"+(String.valueOf(minute)+"pm"));
}
if(hourOfDay==12)
{
datehid.setText("12"+ ":"+(String.valueOf(minute)+"pm"));
}
if(hourOfDay<12)
{
datehid.setText(String.valueOf(hourOfDay)+ ":"+(String.valueOf(minute)+"am"));
}