I am trying to convert GMT time to local device time zone.But the GMT time
String res;
TimeZone tz = TimeZone.getDefault();
String strTimeZone = tz.getDisplayName(false, TimeZone.SHORT);
SimpleDateFormat sdfgmt = new SimpleDateFormat("HH:mma");
sdfgmt.setTimeZone(TimeZone.getTimeZone("GMT"));
SimpleDateFormat sdfmad = new SimpleDateFormat("HH:mma");
sdfmad.setTimeZone(TimeZone.getTimeZone(strTimeZone));
String inpt = "09:00am";
Date inptdate = null;
try {
inptdate = sdfgmt.parse(inpt);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println("GMT:\t\t" + sdfgmt.format(inptdate));
System.out.println("Current Time:\t" + sdfmad.format(inptdate));
res = sdfmad.format(inptdate);
GMT time returns as 00:00am.I cant convert the 9:00am gmt time to local device time zone(GMT+5:30)