【发布时间】:2015-09-23 18:27:02
【问题描述】:
这是我使用时间计算事件日期和当前日期之间间隔的代码。这里我根据时间计算间隔。我不想要那个。我只想要天差地别。我的意思是考虑如果事件日期是 25-09-2015 当前日期:23-09-2015 那么间隔将是 2 天。我需要这种类型的代码。请帮我找出代码
String eventDate = btn_Date.getText().toString();
DateFormat date = new SimpleDateFormat("dd-M-yyyy");
Date date1 = date.parse(eventDate);
Date currentDate = new Date();
daysBefore = (int) ((date1.getTime() - currentDate.getTime()) / (1000 * 60 * 60 * 24));
【问题讨论】:
-
@sathyanagaraj19 试试我的答案。
-
你能看到我的问题吗..帮我找到