I am trying to convert a date in millis to a date and get the time.
I have this code :
long yourmilliseconds = Long.parseLong(model_command.getTime());
Date resultdate = new Date(yourmilliseconds);
When I debug and see the date, it gives a date which is 2h hours too early. It only gives this issues on the emulator (It is probably not programmed in the local hours). I would like to fix this issues to be sure that I always get the hours in the TimeZone GTM+02 but I don't know how to specificly say that.
I have tried something like this :
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long yourmilliseconds = System.currentTimeMillis();
Date resultdate = new Date(yourmilliseconds);
format.setTimeZone(TimeZone.getTimeZone("GTM+02"));
String test = format.format(resultdate).toString(); /**DATE**/
but the lines : format.setTimeZone(TimeZone.getTimeZone("GTM+02"));
seems to be ignored and it still gives the wrong time
Can somebody help? Thanks