2 Replies Latest reply: Oct 5, 2011 2:27 AM by Miikka Koskinen RSS

    Difference of dates based on irregular calendar

    Miikka Koskinen

      Hi!

       

      I'm making production time report. In report I'm calculating how long it takes to manufacture different products. Starting datetime is when order arrives and end datetime is when invoice is formed. I made this and application works fine, but customer has sometimes one shift working on weekdays and sometimes they have three shifts working all week.

       

      So basically calendar is totally user defined.

       

      For example:

       

      Order arrives                    Invoice is formed

      2011-09-30 12:00          2011-10-03 12:00

       

      Case 1:

      Only one shift working on weekdays. Correct answer is 8h. From 2011-09-30 12:00 to 2011-09-30 16:00 and from 2011-10-03 08:00 to 2011-10-03 12:00.

       

      Case 2:

      Three shifts working whole week. Correct answer is 72h.

       

      In real life they might have one shift working from monday to wednesday, 2 shifts working thurday and friday and plant closed on weekend.

       

      Now I'm using intervall-function. To my knowledge you can add holidays to networkingdays-function but you cannot add extra working dates.

       

      My data looks like this:

       

      Order     Category          StartTime                              EndTime

      1               11                    2011-09-14 13:15:08          2011-09-18 12:34:16

      2               12                    2011-09-14 13:16:10          2011-09-14 15:50:30