Your query is definitely very far from an ActiveRecord query syntax. Assuming you are using at least Rails 3 and beginning
and ending
are Time objects:
Bill.where("created_at >= ? AND created_at <= ?", beginning, ending)
or you can also use BETWEEN
passing a Ruby Range
Bill.where(created_at: beginning..ending)
Please avoid to interpolate values in the query like you just did. The resulting query it's not protected against SQL injection.
You may also want to review the ActiveRecord documentation to learn a little bit how to use it properly.
For Rails < 3 you should pass the conditions to the find method.
Bill.find(:all, :conditions => "created_at >= ? AND created_at <= ?", beginning, ending)