I am trying to change a string like this "05/09/14" to a date object using to_date
for example:
"05/09/14".to_date
but I am getting the wrong format, I end up with 14 Sep 0005
Can anybody point me in the right direction?
thanks,
use this :
Date.strptime("05/09/14", "%d/%m/%y")
this will tell rails about the format in which you want to parse your date string.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.