Convert string to date in Scala / Spark

This code snippet shows how to convert string to date.

Raymond Tang Raymond Tang 0 13761 6.19 index 5/27/2019

This code snippet shows how to convert string to date.

In Scala, java.text.SimpleDateFormat class can be used to to convert string to Date object with user provided date format.

Code snippet

import java.text.SimpleDateFormat
import java.util.Date

val format = new SimpleDateFormat("yyyy-MM-dd")
val date = format.parse("2018-03-03")
scala spark

Join the Discussion

View or add your thoughts below

Comments