Hi I have this code in RoR to convert String into a date:
r.valid_from = Date.strptime(row[5], @time_format)
row[5] is 7-11-12 and time_format is “%d-%m-%y”. The result I get with this code is: November 07, 2012 but I would like to get it in this way: 07 November, 2012. How can I do that? Thanks!
It seems you’re successfully parse the string to the
Date. So you just need to print your new date in another format.To achieve
07 November, 2012result, you can usestrftime: