The fastest way to calculate the difference in days is to keep a reference to the days duraction field, and then call getDifference. Problem is that LocalDate does not expose the local millis value, which would make such calculations much quicker.

DurationField daysField = ISOChronology.instanceUTC().days();
...
int differenceInDays = daysField.getDifference(endMillis, startMillis);

The LocalDate class provides limited access to this functionality via a Property.

int differenceInDays = date.dayOfYear().getDifference(instant);

You can only subtract off a ReadableInstant, however.


On 9/14/06, Paul Field <[EMAIL PROTECTED]> wrote:

Hi,

My application has to work out the difference, in days, between two dates a lot. So, I've been investigating the performance of different approaches. Currently, we're using YearMonthDays and I was thinking of moving us to LocalDate but I've noticed that the performance is not as good.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to