我正在尝试像这样进行日期比较:
if date > "Sept 22"
#do stuff
else
#do other stuff
end
我只是想不出如何在 Ruby 中做到这一点(至少看一个特定的日期)。
我正在尝试像这样进行日期比较:
if date > "Sept 22"
#do stuff
else
#do other stuff
end
我只是想不出如何在 Ruby 中做到这一点(至少看一个特定的日期)。
Normal comparison operators work with dates too:
require 'date'
date = Date.new(2012,3,3)
if date > Date.new(2011,4,4)
# do whatever
end