title: How to add conditional date filter to SQLite export script
body: <p>I am using a bash script to export data from the songs table in a Clementine db:</p>
  
  <pre><code>#!/bin/bash
  /usr/bin/sqlite3 /home/username/.config/Clementine/clementine.db &lt;&lt;!
  .headers off
  .mode csv
  select filename from songs where lastplayed &gt; -1;
  !
  </code></pre>
  
  <p>The date information shown in the column <code>lastplayed</code> is expressed in unix time (example:1479607204). Where a record has no date, the field's data is shown as -1.  </p>
  
  <p>Using the above script correctly displays all entries in the songs table that have <em>any</em> lastplayed date (lastplayed > -1).</p>
  
  <p>If instead, I want the date filtered based on number of days elapsed (using today's date, so assume the NOW statement is used in some way), how would I modify the SELECT line above to calculate and filter output?  I reviewed the <a href="https://sqlite.org/lang_datefunc.html" rel="nofollow noreferrer">SQLite manual page for date/time</a> but as a newbie I could not solve how to use its syntax in the script.</p>
  
  <p>Assume the filter lists only those records for which there is a date, and the unix date is at least 10 calendar days earlier than today.</p>