Is there a Date.now equivalent of Time.now/new?

Hi,

On Ruby 1.8.7 and 1.9 somewhere (some ARM NAS device).

Does anyone know if there is a Date.now in 1.9, or one proposed?

It’s a little tedious to go through Date.strptime(Time.now.strftime)
don’t you think? Easy enough to extend Date, but why not in Ruby
already?

Just a thought. Save my fingers and all that.

Apologies if I’m musing in the wrong zone.

M

Mike F. wrote in post #979117:

Hi,

On Ruby 1.8.7 and 1.9 somewhere (some ARM NAS device).

Does anyone know if there is a Date.now in 1.9, or one proposed?

It’s a little tedious to go through Date.strptime(Time.now.strftime)
don’t you think? Easy enough to extend Date, but why not in Ruby
already?

Just a thought. Save my fingers and all that.

Apologies if I’m musing in the wrong zone.

M

Date.today.to_s
=> “2011-02-02”

Peter H. wrote in post #979120:

You could just use Date.today

Works in both 1,8.* and 1.9.*

It is also in the documentation

Thanks. I guess my point was (probably) that Date.now is more intuitive
than Date.today. Well, at least to me, evidently, given that Time.now
came first.

You could just use Date.today

Works in both 1,8.* and 1.9.*

It is also in the documentation

On Wed, Feb 2, 2011 at 10:11 PM, Mike F. [email protected]
wrote:

Thanks. I guess my point was (probably) that Date.now is more intuitive
than Date.today.

not an anglois expert here, but

“date today not date now”
“time now not time today”

Well, at least to me, evidently, given that Time.now came first.

you can always alias anytime…

best regards -botp

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs