In Rails you can use the to_time function on a string to convert it into a Date object
'2012-11-14 14:27:46'.to_time.strftime('%B %e at %l:%M %p')
#=> "November 14 at 2:27 PM"
interactive reference guide, refer to http://www.foragoodstrftime.com/
沒有留言:
張貼留言