From: ideal one Date: 2012-10-06T06:01:13+09:00 Subject: Ruby range - verify if date lies between two specified dates Hi All, I came across some issue in verifying if a date lies between two specified dates. now = Date.today today = now.strftime('%d-%b-%Y') last_Seven_Days = (now - 7).strftime('%d-%b-%Y') As per above, i am calculating today's date and previous seven days and putting in format (ex: 05-Oct-2012) Next I am getting a date from my screen Webpage(getText) and it's stored as a string 'initial_date' ui_date = '2012-10-01' initial_date = Date.parse ui_date initial_date = initial_date.strftime('%d-%b-%Y') puts initial_date => result in 01-Oct-2012 range = (today..last_Seven_Days) I wanted of find if '01-Oct-2012' falls between the range. range === last_date => sometimes comes as TRUE sometimes as FALSE I dunno whether I am properly comparing dates or Strings..!! any better way and stable way to do this. -- Posted via http://www.ruby-forum.com/.