将字符串转换为时间戳 比如将 "2011-10-31" 或 "2011-10-30 15:00:22" 转换为时间戳
http://www.ruby-doc.org/core-1.9.2/Time.html#method-i-strftime
不过可以先考虑 http://www.ruby-doc.org/core-1.9.2/Time.html#method-i-to_s
特别是有 ActiveSupport 的情况下 http://apidock.com/rails/ActiveSupport/TimeWithZone/to_s
找到问题了
DateTime.parse(last_time).to_time.to_i if !last_time.nil?
之前因为 last_time 为空总报错
>> Date.parse "2011-10-31" => Mon, 31 Oct 2011 >> Time.parse "2011-10-30 15:00:22" => 2011-10-30 15:00:22 +0800
转换为时间戳? 秒计数: Time.now.to_i
毫秒计数 Time.now.to_f
testxx