From: 7stud -- Date: 2007-10-13T00:44:14+09:00 Subject: Re: DateTime confusion christriddle@googlemail.com wrote: > Hello! > Wondered if anyone could help... > I'm trying to parse a datetime > > date = DateTime.parse("200701011900") > > Which gives me a datetime. When i print it, it gives: > 2007-01-01T19:00:00+00:00=> nil > > but when I try: > > print date.year > > it gives me an unknown method error.... any ideas what I'm doing > wrong? > > Cheers! > Chris It works fine for me, although I wouldn't name the variable 'date' since it is the same name as the file you are including. require 'date' date = DateTime.parse("200701011900") puts date.year --output:-- 2007 -- Posted via http://www.ruby-forum.com/.