Konvertieren von unix - /epoch-Zeit in formatierten Datum - unerwartete Datum

Ich versuche zu konvertieren timestamp in eine lesbare Datum-und Zeit. Ich habe versucht:

String dateSt = 1386580621268;
Log.i("*****", "date st is = "+dateSt);
long unixSeconds = Long.parseLong(dateSt);
Log.i("*******", "unix seconds is = "+unixSeconds);
Date date = new Date(unixSeconds*1000L); //*1000 is to convert seconds to milliseconds
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); //the format of your date
String formattedDate = sdf.format(date);
System.out.println(formattedDate);

Das erwartete Ergebnis ist 09-12-2013 jedoch bekomme ich 28-12-45908. Das obige Beispiel kann hier gefunden werden: Konvertiert Unix timestamp in Datum java, Antwort von David Hofmann

InformationsquelleAutor DevC | 2013-12-18
Schreibe einen Kommentar