score:0

you can use activesupport string#in_time_zone

in_time_zone(zone = ::time.zone)link converts string to a timewithzone in the current zone if time.zone or time.zone_default is set, otherwise converts string to a time via string#to_time

score:2

in rails you can convert a properly formatted string to milliseconds with:

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

score:14

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:

dates.map!{|d| d.to_datetime.strftime('%q')}

helper links: link-1, link-2


Related Query

More Query from same tag