To_date Error ...

H

Henrik Ekenberg

[Note: parts of this message were removed to make it a legal post.]

Hi,

After a ruby upgrade I have an error with to_date.

C:\>ruby Test_todate.rb
Test_todate.rb:7:in `<main>': undefined method `to_date' for
"2011-01-01":String (NoMethodError)

Any advice ?

code is here
--
require 'rubygems'
require 'active_support'


t = Time.now

if ( t > "2011-01-01".to_date )
end

--
 
B

brabuhr

Hi,

After a ruby upgrade I have an error with to_date.

C:\>ruby Test_todate.rb
Test_todate.rb:7:in `<main>': undefined method `to_date' for
"2011-01-01":String (NoMethodError)

Sorry, I don't have time to dig into an explanation, but try:
require 'active_support/core_ext/string/conversions'
 
R

Robert Klemme

Hi,

After a ruby upgrade I have an error with to_date.

C:\>ruby Test_todate.rb
Test_todate.rb:7:in `<main>': undefined method `to_date' for
"2011-01-01":String (NoMethodError)

Any advice ?

code is here
--
require 'rubygems'
require 'active_support'


t =3D Time.now

=A0if =A0( t > "2011-01-01".to_date )
=A0 =A0end

16:49:38 $ ruby19 -e 'p(Time.now > Time.local("2011-01-01"))'
false

Cheers

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,849
Latest member
Fira

Latest Threads

Top