I have a specific time from my database, and here is what it looks like:
ruby-1.9.2-p290 :017 > djel.smjena.pocetak1.to_time => 2000-01-01 08:00:00 +0100
and thatβs fine, I was assigned 2000-1-1 also, I got something that happened at some datetime
ruby-1.9.2-p290 :019 > dog.pocetak => Thu, 25 Aug 2011 08:18:00 UTC +00:00
So I was hoping that .to_time would break my date, but that would not happen
ruby-1.9.2-p290 :020 > dog.pocetak.to_time => Thu, 25 Aug 2011 08:18:00 UTC +00:00
So, now, comparing if something happened before 8:00 is useless. So how can I compare this? Is there a way to install dog.pocetak for 2000-01-01 without a touch clock?
Thank you
ps In addition, I was thinking of creating a new time variable, only to get hours and minutes from the old variables, but these methods do not work?
ruby-1.9.2-p290 :059 > dog.pocetak.hour => 8
but
ruby-1.9.2-p290 :060 > dog.pocetak.minute NoMethodError: undefined method `minute' for 2011-08-25 08:18:00 UTC:Time from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.10/lib/active_support/time_with_zone.rb:322:in `method_missing' from (irb):60 from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands/console.rb:44:in `start' from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands/console.rb:8:in `start' from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands.rb:23:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>' ruby-1.9.2-p290 :061 > dog.pocetak.minutes NoMethodError: undefined method `minutes' for 2011-08-25 08:18:00 UTC:Time from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.10/lib/active_support/time_with_zone.rb:322:in `method_missing' from (irb):61 from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands/console.rb:44:in `start' from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands/console.rb:8:in `start' from /home/dorijan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.10/lib/rails/commands.rb:23:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'
really upset :)
source share