Forums Register Login

How to calculate Business hours

+Pie Number of slices to send: Send
Hi guys,

I have a Java & SQL web application where a business will enter their business open and closed time for each day of the week (Mon - Sun).

However, I need to display the business hours to the end user.
Example:
Mon - Wed open 8am to 5pm.
Thurs open 8am to 6pm
Fri open 8am to 8pm
Sat & Sun closed

So, my brain has gone dead on trying to figure the best algorithm to dynamicly display business hours including consecutive days.

Can you guys give me suggestions on how to determine business hours using Java or SQL?

Thanks in advance....
+Pie Number of slices to send: Send
quote
------------------------------------------------------------------
However, I need to display the business hours to the end user.
Example:
Mon - Wed open 8am to 5pm.
Thurs open 8am to 6pm
Fri open 8am to 8pm
Sat & Sun closed
-------------------------------------------------------------------

What exactly you are tring to find out??? would you need to display some data based on business hours or someting different?


-Mohan
+Pie Number of slices to send: Send
I think the challenge is the the Mon-Wed part, no? I used to do a lot of group-break loops like this:

Does that make sense? Can anybody do it in SQL?
+Pie Number of slices to send: Send
Thanks for the suggestion...but still does not answer it. As I loop through the list of days in the week, I need to do the following:

1) keep track of the days that have the same open and close time
2) determine if the days that have the same business hours are consecutive (eg. Mon - Fri, or Fri - Sat)
3) the challenge I'm facing is when there are more than 1 consecutive day sets that have the same business hours (eg: Mon-Thurs 8am - 5pm and Fri-Sun 11am - 11pm)

this seems trivial...but I don't understand why I'm having a hard time to come up with a dynamic algorithm for this....

Pls...heLP
+Pie Number of slices to send: Send
Try the loop I showed with pencil & paper ...

Mon 8:00 5:00
Tue 9:00 6:00
Wed 9:00 6:00
Thu 8:00 5:00

I think it will report

Mon 8:00 5:00
Tue-Wed 9:00 6:00
Thu 8:00 5:00
[ September 04, 2007: Message edited by: Stan James ]
New rule: no elephants at the chess tournament. Tiny ads are still okay.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1734 times.
Similar Threads
sun java isnt on Fedora 7
Calculating Time - HELP
Sql Connection
Mock Exam for SCBCD 5.0
Modeling Day of the Week
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:42:02.