Colin Law wrote in post #1056120: > On 12 April 2012 09:36, Damjan Rems <[email protected]> wrote: >> 22:00:00.000000' and date < '2012-04-30 22:00:00.000000') >> >> Which is wrong. Dates should have been 2012-04-01 00:00:00.000000 and >> 2012-05-01 00:00:00.000000 >> >> What is wrong? > > Nothing is wrong. Those dates are the beginning of the month for the > timezone that t is in, converted to UTC as times in the database are > in UTC. In order to get the result you expect then make sure that t > is a UTC time not a local time. > > Colin
Thanks for this one. The problem lies one line before: t = Time.new(params[:year].to_i, params[:month].to_i, 1) And If I use: t = Time.utc(params[:year].to_i, params[:month].to_i, 1) it works OK. Is this a problem of database settings or local server settings or it's the only right way to do it? by TheR -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

