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