how to compare particular date with today to know whether that paricular date is greater than today
Thanks Harish.
@date = "2010-07-20".to_date # 20th July
@today=Date.today # 21st July
if @date >= @today
puts "@date is greater than or equal to today's date"
else
puts "@date is less than today's date"
end
O/P
@date is less than today's date
date
object has future?
and past?
methods. It's the best way I can think of.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With