DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Turn A Date Range Into SQL Conditions

02.01.2006
| 11919 views |
  • submit to reddit
        From <a href="http://project.ioni.st/post/592#post-592">here</a> on Project.ioni.st.

(6.months.ago.to_date..1.year.ago.to_date).to_s(:db)
=> "BETWEEN '2005-07-27' AND '2005-01-22'"