title: Get all rows from the last N days with HBase
body: <p>I'm trying to write a component that fetches rows from HBase from the last 5 days (5 is arbitrary). The timestamp I want to use is the default timestamp HBase gives to rows (unless its problematic for some reason)</p>
  
  <p>I know I can use <a href="https://stackoverflow.com/questions/33242202/get-count-of-hbase-table-based-on-dates">scan and with timestamp</a> range but I'm not quite sure how to get the current date in HBase (I'm currently testing it in the HBase shell but eventually I need to have a code doing that). I've tried something like this:</p>
  
  <pre><code>scan 'urls', {COLUMNS =&gt; 'urls', TIMERANGE =&gt; [SimpleDateFormat.new("yy/MM/dd HH:mm:ss").parse("2016/03/02 00:00:00", ParsePosition.new(0)).getTime(), new Date().getTime()]}
  </code></pre>
  
  <p>but the shell is saying I have a syntax error unexpected tCONSTANT. I did import both Date, SimpleDateFormat and ParsePosition successfully</p>
  
  <p>I also looked at <a href="http://hbase.apache.org/0.94/book/shell_tricks.html" rel="nofollow noreferrer">other examples</a> but could not find exactly what I needed</p>
  
  <p>I was also wondering if there is a more elegant way to accomplish this task?</p>
  
  <p>Thanks in advance</p>