How to create TimestampType column in spark from string

Viewed 21215

I have some datas contained in an Array of String like below (just for exemple):

val myArray = Array("1499955986039", "1499955986051", "1499955986122")

I want to map my list to an array of Timestamp, in order to create an RDD (myRdd) then create a dataframe like this

val df = createdataframe(myRdd, StructType(StructField("myTymeStamp", TimestampType,true)

My question is not how to create the Rdd, but how to replace string by millisecond timestamp. Do you have any idea? Thanks

2 Answers
Related