What would the best way be to check if a date is more than a day old, or a year old etc?
First minus the current date and then uses isBefore () to check if a date is a certain period older than the current date. 1.1 This example checks if a date is 6 months older than the current date.
In the Select Specific Cells dialog, check Cell option, and choose Less than in the first drop down list and click to select the date which is over one year old from today in the beside textbox.
Most of the banks in the United States accept checks which is up to six months from the date written at the date column on the check, even though there are separate check expiry time period for States and local governments. After his date, checks can be considered as stale checks or invalid checks as it will not be accepted by any of the banks.
If this check were in a business deposit, more often than n Can you deposit a check that is 3 years old? Most of the banks in the United States accept checks which is up to six months from the date written at the date column on the check, even though there are separate check expiry time period for States and local governments.
See this question: comparision of date in ruby The compare to a value like
1.day.ago
1.month.ago
1.year.ago
Using these produces the following output:
Loading development environment (Rails 3.0.7)
ruby-1.9.2-p180 :001 > 1.year.ago
=> Thu, 27 May 2010 17:45:25 UTC +00:00
ruby-1.9.2-p180 :002 > 1.month.ago
=> Wed, 27 Apr 2011 17:45:32 UTC +00:00
ruby-1.9.2-p180 :003 > 1.day.ago
=> Thu, 26 May 2011 17:45:36 UTC +00:00
ruby-1.9.2-p180 :004 >
and see if that works.
Use ActiveSupport helpers
@date < 1.day.ago
@some_other_date < 2.years.ago
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