user288231 user288231 - 1 year ago 238
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);

Answer Source

Try this

Date d = new Date(1308670980000L);
SimpleDateFormat f = new SimpleDateFormat("dd.MM.yyyy,HH:mm");
String s = f.format(d); 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download