问题
I want to count days between two date, I found some solutions on the net but the problem is in my NetBeans the GregorianCalendar is not available. So cant calculate the days. Can anyone help ?
回答1:
In Java Micro Edition you don't have GregorianCalendar, so you have to use:
Date startDate, endDate;
...
int days = (int) ((endDate.getTime() - startDate.getTime())
/ (1000 * 60 * 60 * 24));
Where the getTime() method of a Date returns the number of milliseconds since January 1, 1970, 00:00:00 GMT
来源:https://stackoverflow.com/questions/7701397/count-days-between-two-date-j2me