title: Scala conversion long to datetime
body: <p>I am using nscala-time (wrapper for Joda Time) and slick for a project. I'm trying to use this clause to write a line to the database:</p>
  
  <pre><code>Article.insert(0,"title1", "hellothere", DateTime.now.getMillis.asInstanceOf[Timestamp])
  </code></pre>
  
  <p>Apparently Slick does not support "dateTime" type defined in Joda Time, and I have to use <code>java.sql.Timestamp</code> instead. So I decide to do a little conversion inside the <code>insert</code> method, using "asInstanceOf". Unfortunately, Scala quickly tells me that Java.Long cannot be converted to Java.sql.Timestamp. Then I used this:</p>
  
  <pre><code> val dateTime = new DateTime();
   val timeStamp = new Timestamp(dateTime.getMillis());
  
   Article.insert(0,"title1", "hellothere", timeStamp)
  </code></pre>
  
  <p>This magically works, and all I'm left with is confusion.</p>
  
  <p>How can I convert it one way but not the other? Should I use a different conversion than <code>asInstanceOf</code>?</p>