unsupportedOperationException Error converting string to DateTime using Joda time

后端 未结 3 1253
有刺的猬
有刺的猬 2021-01-21 19:16

I am converting string to datetime field using joda.time.Datetime libraries but it throws unsupported exception Here is main class code:

//create new var with          


        
3条回答
  •  日久生厌
    2021-01-21 19:49

    Thanks zero323 for the solution. I used java.sql.Timestamp and here is the code I modified

    val dateYMD: java.sql.Timestamp = new java.sql.Timestamp(DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss").parseDateTime(p(8)).getMillis)
    testData(dateYMD)}.toDF().show()
    

    and changed my class to

    case class testData(GamingDate: java.sql.Timestamp) { }
    

提交回复
热议问题