Ruby 1.87 vs 1.92 Date.parse

前端 未结 5 2060
甜味超标
甜味超标 2021-02-01 12:56

In Ruby 1.87 I could do:

Date.parse (\"3/21/2011\")

Now in 1.9.2 I get:

ArgumentError: invalid date

<
5条回答
  •  旧时难觅i
    2021-02-01 13:48

    I have always had difficulty parsing dates with Date.parse. My solution is gratutious of the chronic gem. I also like the strptime function found in another answer.

提交回复
热议问题