> I have used joda for some projects. I have a requierment to calculate the
> third Friday of any month. Is below the most effecient

Probably easier to see what you're doing if you do something like this:

DateTime getThirdFridayOfMonth(DateTime date) {
  DateTime first = date.withDayOfMonth(1);
  if (first.getDayOfWeek() > DateTimeConstants.FRIDAY) {
    return first.plusWeeks(3).withDayOfWeek(DateTimeConstants.FRIDAY);
  } else {
    return first.plusWeeks(2).withDayOfWeek(DateTimeConstants.FRIDAY);
  }
}

= Adam

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to