Forum: Ruby on Rails parse problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sunny B. (Guest)
on 2009-02-24 10:06
I am using Time.parse for creating time object like
start_date =
Time.parse("#{event.from_year.to_s}-#{event.from_month.to_s}-#{event.from_day.to_s}
#{event.from_time.to_s}")

  end_date =
Time.parse("#{event.to_year.to_s}-#{event.to_month.to_s}-#{event.to_day.to_s}
#{event.to_time.to_s}")

But when i pass input year to this as 1993 then after parsing it give me
result
2001-01-02 20:00:00 like this? why not it give me year as a 1993?

please help me to find solution.
Maurício L. (Guest)
on 2009-02-24 18:57
(Received via mailing list)
Why are you parsing if you have all the data?

Just create a Time object with your parameters. Please read the docs
-> http://www.ruby-doc.org/core/classes/Time.html

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)



On Tue, Feb 24, 2009 at 5:06 AM, Sunny B.
This topic is locked and can not be replied to.