From: "Thomas B." Date: 2008-08-24T18:08:47+09:00 Subject: Re: setting date format to validate date in ruby Jay Pangmi wrote: > Thomas B. wrote: >> You can have a look at this post: >> http://al2o3-cr.blogspot.com/2008/08/downloading-file.html . There's >> date validation in it, in the very general form, working with any >> separator and any number of digits. It uses scanning for digit groups. > > Now what is bothering me is the logic to sort out the dates in the > array. I tried the simplest way "Array.sort" but it only sorted the > array according to the first value it sees not the whole date. How can I > sort it out. Thanks Use the same approach as is used in the post I gave you link to: - create Date objects for each date (once you parse it and see that it is correct), and put the dates in an array, - sort the array of dates, they will get sorted OK, - convert dates back to strings if you need to, using Date#strftime. TPR. -- Posted via http://www.ruby-forum.com/.