From: Glen Holcomb Date: 2007-05-15T06:26:16+09:00 Subject: Re: Time range help ------=_Part_159200_4568321.1179177975483 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 5/14/07, Mike Hamilton wrote: > > Rob Biedenharn wrote: > > On May 14, 2007, at 4:02 PM, Mike Hamilton wrote: > >>>> b = Time.mktime(2007,5,7,0,0,0) > >>> so loud, I can't hear a word you're saying." > >> that I can include the appropriate gmtime adjustment in the query > >> values. > > > > Why do you need to iterate over them? If these values are already in > > the database, can't you just use: > > > > :conditions => { :some_gmt_datetime_column => a..b } > > > > which becomes a where clause like "some_gmt_datetime_column BETWEEN > > '2007-05-01' AND '2007-05-07'" (or whatever a.to_s(:db) gives) > > > > If this doesn't help, perhaps you could explain your query a bit more > > and where you think the iteration is needed. > > > > -Rob > > > > Rob Biedenharn http://agileconsultingllc.com > > Rob@AgileConsultingLLC.com > > The challenge is that the database is just something I'm reporting off > of and isn't something that I designed or built in Rails so I'm doing a > lot of raw SQL. I did manage to find a way around it by building a date > range off of the time objects, iterating over that, and keeping the time > values constant by building them off of the Time objects as well. Works > well enough for what I'm trying to do! > Thanks for the input! > > -- > Posted via http://www.ruby-forum.com/. > > Cool. I was going to suggest using Time's to_datetime method although that might not help you so much if you have to put the data back once you've looked at it. -- "Hey brother christian with your high and mighty errand, Your actions speak so loud, I can't hear a word you're saying." -Greg Graffin (Bad Religion) ------=_Part_159200_4568321.1179177975483--