You can use Activesupport String#in_time_zone

in_time_zone(zone = Converts String to a TimeWithZone in the current zone if or Time.zone_default is set, otherwise converts String to a Time via String#to_time


In Rails you can convert a properly formatted string to milliseconds with:

"2014-06-16 16:00:00".to_datetime.strftime('%Q')


You need to covert sstring to dateTime as the first, Use this code:

DateTime.parse("2011-05-19 10:30:14").strftime('%Q')

Or this code:

"2014-06-16 16:00:00".to_datetime.strftime('%Q')

So you can convert array of strings of dates as the following:!{|d| d.to_datetime.strftime('%Q')}

Helper links: link-1, link-2

Related Query

More Query from same tag