Rails newbie question:
Given a datetime from the db in the format 2012-02-12 23:59:30, how can I check if it’s within 365 days from now?
I’ve tried the following but didn’t work: <%= expedite - Date.today %>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can add a number of days to
Date.todayand see if the date is on or before that:You could also do
Date.today + 1.yearinstead, but that will technically add 365.25 days, not 365.