I know this is a similar question to many out there but I am stuck as to what I am doing wrong in my code.
The server has a timestamp from America and I live in India. I want the fetched timestamp to be converted to my timezone standards. I use this following code block:
SimpleDateFormat formatter = new SimpleDateFormat("dd-M-yyyy hh:mm:ss");
Date date = formatter.parse(serverDate); //Server Date
SimpleDateFormat sdfIndia = new SimpleDateFormat("dd-M-yyyy hh:mm:ss");
TimeZone tzInIndia = TimeZone.getDefault();
sdfIndia.setTimeZone(tzInIndia);
String sDateInIndia = sdfIndia.format(date); //Date Output in String Format
The output time is the same as the input time. Why is it coming out to be the same? Any help where I did wrong?