Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

I was originally trying to do:

Date.today.strftime "%b %d, '%y"
like image 679
Blankman Avatar asked Oct 30 '25 02:10

Blankman


1 Answers

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.)

like image 127
Phrogz Avatar answered Nov 01 '25 17:11

Phrogz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!