I am converting milliseconds to the time of the respective country time format, for example, pakistan, US etc
For example timeinmilliseconds=1549362600000 So its respective Time formate from which I got these milliseconds is 15:30 or 3:30 in 12 hr format When I want to convert these milliseconds back to that time I get 10:30 (Five hrs back)
public String getTimeFromLong(long timeInMilliseconds){
String mytime="";
long minute = (timeInMilliseconds / (1000 * 60)) % 60;
long hour = (timeInMilliseconds / (1000 * 60 * 60)) % 24;
mytime = String.format("%02d:%02d", hour, minute);
return mytime;
}
If I select time 4:00 I converted to that to milliseconds (This part is OK) And wants the time back from milliseconds but get five hours back For example, If I select time 9:30 convert it to milliseconds and then to time I get 4:30