• Post Reply Bookmark Topic Watch Topic
  • New Topic

calculating business hours  RSS feed

 
venkatesh warlu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all & thanks in advance for the solution,

I need to calculate business hours i.e, from 0900 - 1700 for all weekdays. I am having a timer which starts on sunday night and ends by saturday morning. I need to exclude all non business hours and exclude weekends and calculate the working hours alone. please help me. the timer may start any time like on wednesday noon and end by friday noon also. i only want the business hours taken.
please help me in this issue thanks.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More details please.
If you already know the office hours and the days, why do you require a timer to calculate? It's simple math isn't it?
What do you mean by timer may start anytime?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need a definition on what the business hours are. For instance:
This code only allows one entry per day, but you could use List<Entry>[] instead of Entry[] to allow multiple entries per day.
 
venkatesh warlu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Maneesh , I mean by timer in the sense entry and exit time. Suppose a employee comes in by time 10:00 AM on tuesday and goes back by next week monday 10:00 AM . Then the timer difference between out and in time gives the whole hours 1.e, 144 hours. But i need to include only official timings from 09:00 am to 05:00 pm during weekdays alone. So i need 144-45 = 99 hours. This becomes complicated when the out time is by friday afternoon. I need to get time from friday morning till noon and add with other days.
I guess you understood my problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!