Working With Dates And Times In Ruby - Study Mode
[#1] What does the to_date method do when applied to a Time object in Ruby?
Correct Answer
(A) Converts a Time object to a Date object
[#2] How do you find the number of seconds since the Unix epoch for a Time object in Ruby?
Correct Answer
(D) Use the to_i method
[#3] Which method is used to check if a Time object occurs after another Time object in Ruby?
Correct Answer
(C) after?
[#4] What does the utc_offset method return for a Time object in Ruby?
Correct Answer
(B) Returns the offset of the Time object from UTC in seconds
[#5] How do you find the number of months between two Date objects in Ruby?
Correct Answer
(C) Subtract one Date object from another and calculate the difference in months