I'm not figuring out how to convert a Time or DateTime into
a string, and then back into an equivalent object. Initial
attempts were the obvious:
>> d = DateTime.now
=> Mon, 22 Sep 2008 15:29:05 -0700
>> d == d.to_s.to_datetime <-- "should" return true
=> false
>> d.to_s.to_datetime.to_s
=> "2008-09-22T15:29:05+00:00"
So then I tried using the parse() methods:
>> d = DateTime.now
=> Mon, 22 Sep 2008 15:22:07 -0700
>> d == DateTime.parse(d.to_s) <-- "should" return true
=> false
>> d
=> Mon, 22 Sep 2008 15:22:07 -0700
>> DateTime.parse(d.to_s)
=> Mon, 22 Sep 2008 15:22:07 -0700
>> d.to_s
=> "2008-09-22T15:22:07-07:00"
>> DateTime.parse(d.to_s).to_s
=> "2008-09-22T15:22:07-07:00"
>> d.to_s == DateTime.parse(d.to_s).to_s
=> true
Does anyone see what I'm doing wrong?
Thanks!
-glenn
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---