Share Coding

Tutorials, Problems, Stuffs …

Tag Archives: timezone

Convert unixtime to local time with TimeZone and DateFormat on JAVA

java.util.Date localdate = new java.util.Date((long)(unixtime)*1000);
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");

// Set the TimeZone
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));

// Change the time in 24-hour format
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy kk:mm:ss");
Advertisements