title: How to change date from yyyy-mm-dd to dd-mm-yyy using Spark function
body: <p>I'm working on Apache spark project on eclipse using Scala</p>
  
  <p>I would like to change my date format from <code>yyyy-mm-dd</code> to <code>dd-mm-yyyy</code></p>
  
  <p>This is my code:</p>
  
  <pre><code>val conf = new SparkConf().setMaster("local").setAppName("trying")
  val sc = new SparkContext(conf) 
  val x = 
  sc.textFile("/home/amel/1MB")
  .filter(!_.contains("NULL")).filter(!_.contains("Null"))
  
  val re = x.map(row =&gt; {
  val cols = row.split(",")
  val Cycle = cols(2)
  val Duration = Cycle match {
  case "Licence" =&gt; "3 years"
  case "Master" =&gt; "2 years"
  case "Ingéniorat" =&gt; "5 years"
  case "Ingeniorat" =&gt; "5 years"
  case "Doctorat" =&gt; "3 years"
  case _ =&gt; "NULL" }
  (cols(0)+","+cols(1) + "," + Cycle + "," +  cols(3) + "," 
  +Duration)
  })
  re.collect.foreach(println)
  </code></pre>
  
  <p>This is an example of the result I got: </p>
  
  <pre><code>0000023497,2007-06-27,Master,SI,2 years
  </code></pre>
  
  <p>This is what I want my result to look like</p>
  
  <pre><code>0000023497,27-06-2007,Master,SI,2 years
  </code></pre>