奇怪...谁能告诉我这里出了什么问题?这是strptime的错误吗?
1.9.3p194 :079 > format = "%m/%-d/%Y %-I:%M:%S %p"
=> "%m/%-d/%Y %-I:%M:%S %p"
1.9.3p194 :080 > now = Time.now.strftime(format)
=> "12/4/2012 1:44:45 PM"
1.9.3p194 :081 > Time.strptime(now, format)
ArgumentError: invalid strptime format - `%m/%-d/%Y %-I:%M:%S %p'
from /Users/fedenusy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/time.rb:283:in `strptime'
from (irb):81
from /Users/fedenusy/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
from /Users/fedenusy/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
from /Users/fedenusy/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
编辑:澄清一下,我正在尝试使用这种特定格式的日期,例如“12/4/2012 1:44:45 PM”。