"/>

how to convert current_timestamp() value in to a string in scala

i have been trying to add timestamp to my dataframes and persist them in to hive.But here is the problem, As i cannot use timestamp as a data type in my 0.13 version hive, i want to convert current_timestamp()in timestamp data type to string so that i can load it in to my hive table.

Here is my timestamp column,

[2017-01-12 12:55:55.278] [2017-01-12 12:55:55.278] [2017-01-12 12:55:55.278] [2017-01-12 12:55:55.278] [2017-01-12 12:55:55.278]

i have tried this but with no luck:

 val ts = current_timestamp()
    val df:SimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd")
    val date:String = df.format(ts.toLong)

Any way to convert the timestamp to string in scala??

Read Full News
Submit your Tech Updates