My rails application has a Photo model which has a DATETIME column called taken_at.
I'm trying to understand why I get a different timestamp (num of secs since epoch) using the following methods:
Photo.find(3095).taken_at.to_i # => 1307292495
Photo.select("id, UNIX_TIMESTAMP(taken_at) as timestamp").where(:id => 3095).first['timestamp'] # => 1307317695
Photo.find(3095).taken_at.strftime('%s') # => "1307267295"
I'm using MySQL as the database and I'm using rails 4.1.7
- thanks!