title: Ruby: How to extract an hour (or day) from a date-time string
body: <p>I'm pulling date-time strings from a large CSV file, which look like this:</p>
  
  <pre><code>"11/19/2008 21:56"
  </code></pre>
  
  <p>I'd like to extract the hour only, so I can build a histogram of all the hours to find the most frequent ones. Similarly, I'd like to extract days of the week (names) from the dates and build a histogram of most frequent days.</p>
  
  <p>I'm new to Ruby, looked up the information, for starters tried various forms of the following, but no luck:</p>
  
  <pre><code>require 'date'
  puts DateTime.strptime("11/19/2008 21:56", '%I')
  </code></pre>
  
  <p>Can you please advise a simple (and clear) way to accomplish the above? Also, any suggestions how to represent the results would be great. I'm thinking one hash array for the hours (24 entries) and one for the days (7 entries)? What would be the neatest algorithm to load them up as I iterate through the date-time strings, and then maybe re-sorting them with most frequent on top? Thanks!!</p>