From: Gordon Thiesfeld Date: 2007-08-01T08:20:01+09:00 Subject: Re: help with string matching > @calendar1 is a gtk calendar widget, and within ruby calling > @calendar1.date > returns the date as 2007730, which caused Date.parse to crash as there > is only 1 part instead of the expected 3. That is why I used the > @calendar1.year @calendar1.month @calendar1.day, but @calendar1.month > returns 0 based months, which is why I used @calendar1.month + 1, which > works, but looks sloppy. Ahh, I made some pretty bad assumptions about what you were trying to do. I'm sorry. > So, how would you parse a date formated as 2007730 into 2007-06-30? I > know that I could parse it out manually, but I'm assuming there is a > more elegant solution. > I guess I would do this: Date.civil(@calendar1.year, @calendar1.date + 1, @calendar1.day).to_s