Hi, here's my results for the various Ruby implementations:

Ruby 1.8.6:

>> Time.now
=> Sun Aug 30 13:49:32 -0700 2009
>> Time.today
NoMethodError: undefined method `today' for Time:Class
from (irb):2
>> Date.today
=> Sun, 30 Aug 2009
>> quit

Ruby 1.8.7:

>> Time.now
=> 2009-08-30 13:51:31 -0700
>> Time.today
NoMethodError: undefined method `today' for Time:Class
from (irb):2
from /opt/local/bin/irb:12:in `<main>'
>> quit

Ruby 1.9.1:

>> Time.now
=> 2009-08-30 13:54:31 -0700
>> Time.today
NoMethodError: undefined method `today' for Time:Class
from (irb):2
from /opt/local/bin/irb:12:in `<main>'
>> quit

Good luck,

-Conrad

On Sun, Aug 30, 2009 at 1:43 PM, Jeremy Kemper <[email protected]> wrote:

>
> Date.today is part of Ruby standard library (not added by Rails).
>
> jeremy
>
> 2009/8/30 Maurício Linhares <[email protected]>:
> >
> > Time has no today method, today is a Date method added by rails, as in
> > Date.today.
> >
> > The method that looks like the same in time is Time.now.
> >
> > -
> > Maurício Linhares
> > http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
> >
> >
> >
> > On Sun, Aug 30, 2009 at 4:58 PM, Kieran P<[email protected]> wrote:
> >>
> >> You can do something like this (utilizing a Rails time method):
> >>
> >> class Time
> >>  def self.today
> >>    Time.now.beginning_of_day
> >>  end
> >> end
> >>
> >>>> Time.today
> >> => Mon Aug 31 00:00:00 +1200 2009
> >>
> >> Regards
> >> Kieran
> >>
> >> On Aug 29, 8:24 pm, Fernando Perez <[email protected]>
> >> wrote:
> >>> > Time.today exists on 1.8.7,
> >>> > but not 1.9.1 (or 1.8.6 to my knowledge)
> >>>
> >>> Damn that's the answer!
> >>> --
> >>> Posted viahttp://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to