How would I get a UNIX timestamp (number of seconds since 1970 GMT) from a Date object in a Rails app?
I know Time#to_i returns a timestamp, but doing <
Time#to_i
Solution for Ruby 1.8 when you have an arbitrary DateTime object:
1.8.7-p374 :001 > require 'date' => true 1.8.7-p374 :002 > DateTime.new(2012, 1, 15).strftime('%s') => "1326585600"