I'm using two JFormattedTextFields
in Java for Date in my JFrame
. I formatted them in format (DD/MM/YYYY)
.
How can i find difference between them in days?
I'm using two JFormattedTextFields
in Java for Date in my JFrame
. I formatted them in format (DD/MM/YYYY)
.
How can i find difference between them in days?
您可以使用乔达时间
DateTime date1 = new DateTime(2013, 12, 20, 0, 0);
DateTime date2 = new DateTime(2013, 12, 23, 0, 0);
Days.daysBetween(date1, date2).getDays(); // Will return 3
//since date2 is 3 days after date1
解析日期,使用 Calendar 标准类或 Joda Time 库来比较日期。