title: convert epoch to datetime in Scala / Spark
body: <p>I'm converting String representing a DateTime to unix_time (epoch) using :   </p>
  
  <pre><code>def strToTime(x: String):Long = { DateTimeFormat.
      forPattern("YYYY-MM-dd HH:mm:ss").parseDateTime(x).getMillis()/1000 }
  </code></pre>
  
  <p>to get a list of Long like this : </p>
  
  <pre><code>.map( p=&gt; List( strToTime(p(0) ) ) ) 
  </code></pre>
  
  <p>my question is - what is the easiest way to turn in backwards?
  something like:    </p>
  
  <pre><code>def timeToStr(x: Long):String = { x*1000L.toDateTime}
  </code></pre>
  
  <p>that I could use on the above List(Long)</p>
  
  <p>I have read  <a href="https://stackoverflow.com/questions/18680398/convert-seconds-since-epoch-to-joda-datetime-in-scala">Convert seconds since epoch to joda DateTime in Scala</a> but can't apply it successfully</p>