title: Storing Business Hours in a Database
body: <p>I'm currently trying to work out the best way to store a business' hours of operation in a database.</p>
  
  <p>For example:</p>
  
  <p>Business A has the following hours of operation</p>
  
  <ul>
  <li>Monday: 9am - 5pm</li>
  <li>Tuesday: 9am - 5pm</li>
  <li>Wednesday: 9am - 5pm</li>
  <li>Thursday: 9am - 5pm</li>
  <li>Friday: 9am - 5pm</li>
  <li>Saturday: 9am - 12 Midday</li>
  <li>Sunday: Closed</li>
  </ul>
  
  <p>Currently I'm have a data model similar to the following</p>
  
  <pre><code>CREATE TABLE "business_hours" (
      "id" integer NOT NULL PRIMARY KEY,
      "day" varchar(16) NOT NULL,
      "open_time" time,
      "close_time" time
  )
  </code></pre>
  
  <p>where the "day" is restricted to a choice of the 7 days of the week in code (through the ORM). To test if a business is closed on a certain day it checks if the open_time and close_time are NULL. It is related to the business through a intermediate table (Many To Many Relationship).</p>
  
  <p>Does any one have any suggestions for this database scheme? Something about it doesn't seem right to me.</p>