ruby - Date returns non-existing day -


i'd iterate on days in month, so:

require 'time' time.now.month # => 5 time.now.day.next # => 32 

what mean? 32nd of may?

also,

rota.rb:2:in `<main>': undefined method `days_in_month' time:class (nomethoderror) 

what's wrong?

this should explain it:

time.now.day.class => fixnum 

fixnum doesn't know dates, have method next.

if want advance next day then:

(time.now + (60 * 60 * 24)).day => 1 

or if have rails installed can do:

require 'active_support/time' (time.now + 1.day).day => 1 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -