Get month number of a date

how can i get the month number of a specific.

for example this code don´t work

month(Date.today)

On Jul 6, 2006, at 5:51 PM, sail wrote:

how can i get the month number of a specific.

for example this code don´t work

month(Date.today)

Time.now.month
=> 7

On 7/6/06, sail [email protected] wrote:

how can i get the month number of a specific.

for example this code don´t work

month(Date.today)

Date.today.month

For more info:

http://www.ruby-doc.org/core/classes/Date.html

Tom

On Jul 6, 2006, at 6:09 PM, sail wrote:

for example in visualbasic today is
cdbl(date) = 38904

Assuming that the “value double of a date” is like the number of days
since some date in the past, you could do:

require ‘date’
=> true

Date.today.jd - 38904
=> 2415019

class Date
def cdbl(start=2415019)
self.jd - start
end
end
=> nil

Date.today.cdbl
=> 38904

Then tomorrow will be:

Date.today.succ.cdbl
=> 38905

I suppose that’s what you’re asking, but perhaps you need to step
back and think about what you are really trying to accomplish. (And
if a direct translation from visualbasic is the right thing to do.)

-Rob

tanks

Tom W. & Rob B.

that works very well.

but i have a new question more complex for you…

how can i get the value double of a date.

for example in visualbasic today is
cdbl(date) = 38904

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