Open source reader

Friday, June 09, 2006

*simple* date API

Here's what I found for handling dates: joda time. It is worth the time to digg into...
Here is what you could do with :
public boolean isRentalOverdue(DateTime datetimeRented) {
Period rentalPeriod = Period.days(2);
public boolean isJoinedInLastThreeMonths(DateTime datetimeJoined) {
Interval last3Months = new Interval(Period.months(3), new DateTime());
return last3Months.contains(datetimeJoined);
public String getBirthMonthText(YearMonthDay dateOfBirth) {
return dateOfBirth.monthOfYear().getAsText(Locale.ENGLISH);
You'll find a quick user guide and a full user guide ...
Happy reading !


Post a Comment

<< Home