From: Brian Candler Date: 2010-05-11T22:52:15+09:00 Subject: Re: Differences in Time v1.8.6 and 1.9.1 Daniel He wrote: > Yes, that worked for me too. > > But I'm still stuck, as I need the mysql-access. Why would mysql break > the Time functionality btw? I'm not saying it is; but you asserted that "the strftime-option gets ignored totally in 1.8.6", and I don't see any evidence of that so far. What you need to do is to make a smallest-possible test case. Keep trimming code out of your program until it stops demonstrating the problem. In the process of doing this, you will probably discover for yourself where the problem lies and how to work around it. If you can't, then at least you'll have a simple test case which can be used by others to reproduce it. We can't run your code as it is, because we don't have the mysql database it depends on; and even if we did, we probably couldn't be bothered setting it up unless you've first demonstrated that mysql *is* an essential part of reproducing your issue. Just glancing at your code I can see it does some weird things: t = Time.now.strftime("%Y-%m-%d %H").to_i # t = Time.now print t.to_s + "\n" t2 = t.to_i - 3600 t2 = Time.at(t2) print t2.to_s + "\n" t3 = t2.to_s.slice! 0..12 print t3.to_s + "\n" That strftime line is just a very strange way of extracting the year (only) from the time: >> t = Time.now.strftime("%Y-%m-%d %H") => "2010-05-11 14" >> t.to_i => 2010 You haven't even shown us what those print lines show. Are they what you expect? If not, what do you see, and what did you expect to see? Or is the problem occurring later on in the code? -- Posted via http://www.ruby-forum.com/.