我不知道为什么不同的输入但是输出是重复的,这是我的代码
Date d = new Date(1409716800);
Date d1 = new Date(1409716801);
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yy-HH:mm:ss");
String formattedDate = sdf.format(d);
String formattedDate1 = sdf.format(d1);
Log.d("time", formattedDate);
Log.d("time", formattedDate1);
输出
10-24 06:12:50.508: D/time(29097): 17.01.70-07:35:16
10-24 06:12:50.508: D/time(29097): 17.01.70-07:35:16
谁能告诉我为什么输出是重复的?我的时区是GMT + 7
答案 0 :(得分:1)
Date d = new Date(1409716800);
Date d1 = new Date(1409716801);
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yy-HH:mm:ss:SSS");
String formattedDate = sdf.format(d);
String formattedDate1 = sdf.format(d1);
Log.d("time", formattedDate);
Log.d("time", formattedDate1);
输出:
17.01.70-14:35:16:800
17.01.70-14:35:16:801