I'm working on Apache spark project on eclipse using Scala
I would like to change my date format from yyyy-mm-dd
to dd-mm-yyyy
This is my 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 => {
val cols = row.split(",")
val Cycle = cols(2)
val Duration = Cycle match {
case "Licence" => "3 years"
case "Master" => "2 years"
case "Ingéniorat" => "5 years"
case "Ingeniorat" => "5 years"
case "Doctorat" => "3 years"
case _ => "NULL" }
(cols(0)+","+cols(1) + "," + Cycle + "," + cols(3) + ","
+Duration)
})
re.collect.foreach(println)
This is an example of the result I got:
0000023497,2007-06-27,Master,SI,2 years
This is what I want my result to look like
0000023497,27-06-2007,Master,SI,2 years