datetime - How do you convert YYYY-MM-DDTHH:MM:SSZ time format to MM/DD/YYYY time format in Ruby? -
for example, i'm trying convert 2011-01-19t00:00:00z 01/19/2011. what's simplest way of accomplishing this?
you can use time.parse
parse time string time
object. can use strftime
turn string format like:
require 'time' time.parse("2011-01-19t00:00:00z").strftime("%m/%d/%y") #=> "01/19/2011"
Comments
Post a Comment