I am receiving following JSON Array in this format from back end
[
{
"time": "4:40pm",
"country": "Australia"
},
{
"time": "3:30pm",
"country": "america"
},
{
"time": "6:30am",
"country": "mexico"
}
]
I need to parse this json and convert each time to IST (Indian) time
I started this way , i am setting the timezone , but couldn't able to convert this time to IST
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
public class Testing {
public static void main(String[] args) throws ParseException {
String time = "4:40pm";
String country = "Australia";
convertDate(time, country);
}
public static String convertDate(String time, String country)
throws ParseException {
SimpleDateFormat in = new SimpleDateFormat("hh:mm");
if (country.equals("Australia")) {
in.setTimeZone(TimeZone.getTimeZone("Australia/Sydney"));
in.parse(time).toString();
}
return "";
}
}