title: OrientDB date manipulation in OSQL to find a path with nodes on the same day but different years
body: <p>I have a graph that is structured like this:</p>
  
  <p>A --> B</p>
  
  <p>A has a Date field.</p>
  
  <p>This is still based on the same problem as in <a href="https://stackoverflow.com/questions/39500535/orientdb-create-edge-between-two-nodes-with-the-same-day-of-year">my other question</a>, but this differs in that I'm not concerned with trying to do everything in one OSQL call to create edges.  In this case, I'm only trying to generate a path that looks like:</p>
  
  <p>A1 (date=2014-01-01) ---> B &lt;--- A2 (date=2013-01-01)</p>
  
  <p>And return a table containing just the A1 and A2 id's.</p>
  
  <p>I've started working up a MATCH query that looks like:</p>
  
  <pre><code>MATCH {CLASS: A, AS: A1} -edgeTypeA-&gt;
    {AS: B} &lt;-edgeTypeA-
    {AS: A2, WHERE: {$matched.A1.Date=$currentMatch.Date}
  RETURN A1, B, A2
  </code></pre>
  
  <p>This works but it's only returning matches where basically A1 and A2 are the exact same date (including where A1 and A2 are the same node).  </p>
  
  <p>I know I can extract parts of a date field using format()... for example, if I just want a string containing the year I could use $currentMatch.Date.format('yyyy') to get that but I still haven't figured out how to increment that date for the purposes of my query.</p>