時刻文字列の書式指定
strftimeを使うと、日時を書式指定して文字列化できます。
t = Time.gm(2006, 1, 2, 3, 4, 5) p t.strftime("%Y-%m-%d %H:%M:%S") #=> "2006-01-02 03:04:05" p t.strftime("%Y%m%d%H%M%S") #=> "20060102030405"
iso8601なども面白い。
require 'time' t = Time.now p t.iso8601 #=> "2006-12-11T14:08:34+09:00"