に日付に変換されません:タイムスタンプが正しくJavaの
String str = "14799744000000800";//last four digit is time zone
DateFormat timeZoneFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
timeZoneFormat.setTimeZone(TimeZone.getTimeZone("GMT-8"));
Date time = new java.util.Date(Long.parseLong(str));
System.out.println(timeZoneFormat.format(time));
をしかし、それは'21 -03- 0時00分00秒印刷します'21/03-2016 00:00:00の代わりに
ご覧のとおり、年の部分は正しく変換されていません。これを修正するには?
ミリ秒の値は間違いありませんか?私が見る限り、この変換は大丈夫です。 21-03-2016は1458518400000ミリ秒で、値14799744000000800がはるかに大きい – siarheib
最後の4桁がこのようなタイムゾーンです1479974400000-0800 –