Time object without minutes and seconds?

Am I missing something or …

irb(main):013:0> tim1 = Time.now
=> Sat Jan 19 23:40:23 +0100 2008irb(main):014:0> puts tim1.year
2008
=> nil
irb(main):015:0> puts tim1.month
1
=> nil
irb(main):016:0> puts tim1.day
19
=> nil
irb(main):017:0> puts tim1.hour
23
=> nil
irb(main):018:0> puts tim1.minute
NoMethodError: undefined method `minute’ for Sat Jan 19 23:40:23 +0100
2008:Time

    from (irb):18

irb(main):019:0> puts tim1.minutes
NoMethodError: undefined method minutes' for Sat Jan 19 23:40:23 +0100 2008:Tim e from (irb):19 irb(main):020:0> puts tim1.second NoMethodError: undefined methodsecond’ for Sat Jan 19 23:40:23 +0100
2008:Time

    from (irb):20

irb(main):021:0> puts tim1.seconds
NoMethodError: undefined method `seconds’ for Sat Jan 19 23:40:23 +0100
2008:Tim
e
from (irb):21
irb(main):022:0>

???

TIA
Adrie

http://ruby-doc.org/core/classes/Time.html

There are no methods “minute” and “second”. Use “min” and “sec” instead.

t.min
t.sec

Peace,
Phillip

On Jan 19, 2008, at 4:45 PM, Adrie D. wrote:

Am I missing something or …

Phillip K. wrote:

t.min
t.sec

Peace,
Phillip

On Jan 19, 2008, at 4:45 PM, Adrie D. wrote:

Am I missing something or …

Thanks, but it is strange that the docs on
http://www.railsdocumentation.org/api/ don’t mention min en sec but
minutes en seconds instead. Why isn’t this documentation up-to-date?
And… do you know whereto find an up-to-date reference?

Adrie

Adrie D. wrote:

http://www.railsdocumentation.org/api/ don’t mention min en sec but
minutes en seconds instead. Why isn’t this documentation up-to-date?
And… do you know whereto find an up-to-date reference?

Adrie

http://ruby-doc.org/core/classes/Time.html

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