DateTime.strptime with format '%m-%d-%Y %H:%M:%S %Z'
date_and_time = '%m-%d-%Y %H:%M:%S %Z'
require 'date'
puts DateTime.strptime('02-09-2007 12:30:44 EST', date_and_time).to_s
puts DateTime.strptime('02-09-2007 12:30:44 PST', date_and_time).to_s
puts DateTime.strptime('02-09-2007 12:30:44 GMT', date_and_time).to_s
Related examples in the same category