Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating end date while skipping holidays + Joda time

Tags:

java

jodatime

I would like to calculate end date (and time) of an event. I know starting date and duration (in minutes). But:

  1. I have to skip holidays - non-recurrent situation
  2. I have to skip weekends - recurrent situation
  3. I have to not count working time (e.g: from 8:00am till 5:00pm) - recurrent situation, but with finer granularity

Is there a simple way to achieve these cases using Joda time library?

like image 862
picca Avatar asked May 01 '10 19:05

picca


2 Answers

Jodatime will help you -a lot I'd say-, but you'll need to write the logic yourself, a loop skipping some entire days and some times of the day. Not very simple, neither very complex, it seems to me.

like image 85
leonbloy Avatar answered Oct 03 '22 05:10

leonbloy


Have you looked into Holiday calculation project? it is featured in the Related projects from jodatime and could be useful

like image 39
Persimmonium Avatar answered Oct 03 '22 06:10

Persimmonium