date.parse does not work anymore

J

Junkone

i am sure i have used date.parse in my code. however it does not work
anymore. i also tried to change the string format but it did not help.
any assistance is appreciated.

irb(main):022:0> Date.parse("2006-01-02")
NoMethodError: undefined method `parse' for Date:Class
from (irb):22
irb(main):023:0> Date.parse("03/28/2008")
NoMethodError: undefined method `parse' for Date:Class
from (irb):23
irb(main):024:0> Date.parse("28/3/2008")
NoMethodError: undefined method `parse' for Date:Class
from (irb):24
irb(main):025:0> Date.strptime('28/03/2008', '%d/%m/%Y')
NoMethodError: undefined method `strptime' for Date:Class
from (irb):25
irb(main):026:0>
 
S

Stefano Crocco

i am sure i have used date.parse in my code. however it does not work
anymore. i also tried to change the string format but it did not help.
any assistance is appreciated.

irb(main):022:0> Date.parse("2006-01-02")
NoMethodError: undefined method `parse' for Date:Class
from (irb):22
irb(main):023:0> Date.parse("03/28/2008")
NoMethodError: undefined method `parse' for Date:Class
from (irb):23
irb(main):024:0> Date.parse("28/3/2008")
NoMethodError: undefined method `parse' for Date:Class
from (irb):24
irb(main):025:0> Date.strptime('28/03/2008', '%d/%m/%Y')
NoMethodError: undefined method `strptime' for Date:Class
from (irb):25
irb(main):026:0>

require 'date'

Stefano
 
I

Iñaki Baz Castillo

El Jueves, 14 de Agosto de 2008, Junkone escribi=F3:
i am sure i have used date.parse in my code. however it does not work
anymore. i also tried to change the string format but it did not help.
any assistance is appreciated.

irb(main):022:0> Date.parse("2006-01-02")
NoMethodError: undefined method `parse' for Date:Class
from (irb):22
irb(main):023:0> Date.parse("03/28/2008")
NoMethodError: undefined method `parse' for Date:Class
from (irb):23
irb(main):024:0> Date.parse("28/3/2008")
NoMethodError: undefined method `parse' for Date:Class
from (irb):24
irb(main):025:0> Date.strptime('28/03/2008', '%d/%m/%Y')
NoMethodError: undefined method `strptime' for Date:Class
from (irb):25
irb(main):026:0>

Don't ask me way, but you must load "date.rb" library instead of "time.rb"=
=20
library.
Both contain "Date" class but just "date.rb" contains that method.

=2D-=20
I=F1aki Baz Castillo
 

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

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top