I am learning Ruby from a book called "Apress Beginning Ruby from Novice to Professional 2nd edition" in that they have given an example which is: Time.local(year, month, day, hour, min, sec, msec) When I am trying the above example I am getting the below error. How to solve this issue? Please help. irb(main):022:0> Time.local(year, month, day, hour, min, sec, msec) NameError: undefined local variable or method `year' for main:Object from (irb):22 from D:/Ruby200-x64/bin/irb:12:in `<main>'
on 2014-04-24 10:43
on 2014-04-24 17:46
You need to define the variable "year" or implement a method called "year" that will return a value. Typically you would do year = 2014 month = 3 ... puts Time.local(year, month, day, hour, min, sec, msec)