Get yesterday's date
This may be an obvious question but im new to ruby and I've spent ages trying to get yesterdays date for a cucumber test that checks a url that includes yesterday's date. for example: http://www.blah.co.uk/blah/blah/schedule/2011-11-28
I've created the following within my helper methods:
def Helper.get_date Time.now.strftime('%Y-%m-%d') / 1.day end
But it doesn’t like the /1.day or – 1.day or – 86400 (seconds).
Would be a non rails-specific way.
You can use some of the methods in ActiveSupport (which will be included if you're in a Rails app) to do the following:
EDIT: As it's a standard date format, you could also reference the standard directly: