From: Dan Daniels Date: 2007-08-01T06:49:10+09:00 Subject: Re: help with string matching Gordon Thiesfeld wrote: > On Jul 31, 2:47 pm, Dan Daniels wrote: >> This does not work: >> >> logdate = "#...@calendar1.year}-" + (@calendar1.month + 1).to_s + >> "-...@calendar1.day}" >> #output is: 2007-07-30 > > > You might also look at using Time#strftime to get your string: > >>> t = Time.local(2007,7,30) > => Mon Jul 30 00:00:00 -0500 2007 >>> t.strftime('%Y-%m-%d') > => "2007-07-30" Good call, I ended up with this: logdate = "#{@calendar1.year}-" + (@calendar1.month + 1).to_s + "-#{@calendar1.day}" > => "2007-7-30" logdate = Date.parse(logdate).to_s > => "2007-07-30" Would Time#strftime be better? -- Posted via http://www.ruby-forum.com/.