I'm new to Spark SQL and am trying to convert a string to a timestamp in a spark data frame. I have a string that looks like '2017-08-01T02:26:59.000Z' in a column called time_string
My code to convert this string to timestamp is
CAST (time_string AS Timestamp)
But this gives me a timestamp of 2017-07-31 19:26:59
Why is it changing the time? Is there a way to do this without changing the time?
Thanks for any help!
unix_timestampto cast it to TimestampType :)Spark 2.3.2(emr-5.19.0), I can confirm theCAST(time_string AS timestamp)worked without a glitch (didn't change the time)