title: Date use in linear regression and conversion of date to numbers using spark mllib
body: <p>I want to use a date in linear regression.
  So I have to convert it to a number. And I have to set lowest date 0 and continuously increase a number as per date difference. </p>
  
  <p>Then I can use date field in Linear Regression using Scala, Spark MLlib.
  I have dataframe ready with some fields including date.
  For example,</p>
  
  <pre><code>| date       | id |
  | 01-01-2017 | 12 |
  | 01-02-2016 | 13 |
  | 05-05-2016 | 22 |
  </code></pre>
  
  <p>For a string, I have implemented using one hot encoding technique. But for date how can I set first date to 0 and then increase number as per difference?
  Thanks.</p>