user288231 user288231 - 4 months ago 49
Android Question

Android Convert Unix Time to GMT time

I'm having trouble in converting a unix time into GMT.

I have the following code, but I would like to know how to vice versa it.

public static String GetUnixTime()
Calendar calendar = Calendar.getInstance();
long now = calendar.getTimeInMillis();

return Long.toString(now);


Try this

Date d = new Date(1308670980000L);
SimpleDateFormat f = new SimpleDateFormat("dd.MM.yyyy,HH:mm");
String s = f.format(d);