Reputation: 1459
I do not know why different input but the output is duplicate, here is my code
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);
The output is
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
can anyone tell me why the output are duplicate? My timezone is GMT+7
Upvotes: 0
Views: 301
Reputation: 143
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);
Ouput:
17.01.70-14:35:16:800
17.01.70-14:35:16:801
Upvotes: 1