Is there a nice way to convert the timestamp you get from twitter (shown below) into a nice unix timestamp using ruby?开发者_开发问答
Tue, 05 Apr 2011 12:33:00 +0000
Any help would be appreciated!
Time.parse
to convert it to Ruby Time
and Time#to_i
to get your Unix time.
# Load the Time.parse method.
require 'time'
Time.parse('Tue, 05 Apr 2011 12:33:00 +0000').to_i
#=> 1302006780
精彩评论