Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
sort on European date
aidy
6/8/2009 3:44:00 PM
Hi,
date = ['15/10/1971', '16/10/1972', '12/12/1971']
real = date.map {|s| Date.parse s}
puts real.sort
Could anyone please tell me how I can parse the date in this sort with
a European format?
Thanks
Aidy
1 Answer
Rick DeNatale
6/8/2009 4:08:00 PM
0
On Mon, Jun 8, 2009 at 11:45 AM, aidy<aidy.lewis@googlemail.com> wrote:
> Hi,
>
> date = ['15/10/1971', '16/10/1972', '12/12/1971']
> real = date.map {|s| Date.parse s}
> puts real.sort
>
> Could anyone please tell me how I can parse the date in this sort with
> a European format?
real = date.map {|s| Date.strptime(s, "%d/%m/%Y")}
--
Rick DeNatale
Blog:
http://talklikeaduck.denh...
Twitter:
http://twitter.com/Ri...
WWR:
http://www.workingwithrails.com/person/9021-ric...
LinkedIn:
http://www.linkedin.com/in/ri...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
sort on European date
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password