Hi to all, I have some time defined from my database, and this is how it looks: ruby-1.9.2-p290 :017 > djel.smjena.pocetak1.to_time => 2000-01-01 08:00:00 +0100 and that is ok, it assigned me 2000-1-1 also, I got something that happened in 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 ditch my date, but that does 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 that? is there a way to set dog.pocetak to 2000-01-01 without touch clock? thank you -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 21 August 2011 00:14, Dorijan Jelincic <dmailj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi to all, > I have some time defined from my database, and this is how it looks: > > ruby-1.9.2-p290 :017 > djel.smjena.pocetak1.to_time > => 2000-01-01 08:00:00 +0100 > > and that is ok, it assigned me 2000-1-1 > > also, I got something that happened in 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 ditch my date, but that does 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 that? is there a way to set dog.pocetak to > 2000-01-01 without touch clock?What is the column type of pocetak? Look in db/schema.rb and see what it has for that column. Colin -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Aug 21, 2011 at 7:14 AM, Dorijan Jelincic <dmailj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi to all, > I have some time defined from my database, and this is how it looks: > > ruby-1.9.2-p290 :017 > djel.smjena.pocetak1.to_time > => 2000-01-01 08:00:00 +0100 > > and that is ok, it assigned me 2000-1-1 > > also, I got something that happened in 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 ditch my date, but that does 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 that? is there a way to set dog.pocetak to > 2000-01-01 without touch clock? > thank you >just create a new time object which is the same as dog.pocetak and change the time of that object to 8:00 for_compare = dog.pocetak.change :hour => 8, :minutes => 0, :second => 0 now you have an object to compare to> > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.