开发者

Why doesn't Date.today work on Ruby console (irb)?

In irb I am trying Date.today and it fails.

I was origi开发者_如何学运维nally trying to do:

Date.today.strftime "%b %d, '%y"


How does it fail? Does it fail like this?

phrogz$ irb
> Date.today
NameError: uninitialized constant Object::Date
    from (irb):1
    from /usr/local/bin/irb:12:in `<main>'

> require 'date'
#=> true

> Date.today
#=> #<Date: 2010-12-05 (4911071/2,0,2299161)>

If so, there's your answer. (If not, then provide more details and we'll move forward from there.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜