puts "date --- #{date}"
@date = Time.parse(date.to_s).iso8601 unless date.nil?
puts "@date -- #{@date}"
输出
Date --- 2012-08-12T12:15:17-07:00
@Date -- 2012-08-12T19:15:17+00:00
有谁知道为什么?
此外,这发生在 strptime
Time.strptime("2012-08-12T12:05:08-07:00", "%Y-%m-%dT%H:%M:%S%:z")
=> 2012-08-12 19:05:08 +0000