Convert server time to local time in android
original source : https://stackoverflow.com/questions/35378221/convert-server-time-to-local-time-in-android
If i understood your problem correctly, you want to convert time between time zones. Here is the code to do that.
public void convertDate(Date d) {
//You are getting server date as argument, parse your server response and then pass date to this method
SimpleDateFormat sdfAmerica = new SimpleDateFormat("hh:mm:ss");
String actualTime = sdfAmerica.format(d);
//Changed timezone
TimeZone tzInAmerica = TimeZone.getTimeZone("CST");
sdfAmerica.setTimeZone(tzInAmerica);
String convertedTime = sdfAmerica.format(d);
System.out.println("actual : " + actualTime + " converted " + ConvertedTime);
return convertedTime;
}
Hope this will help.