when i execute
sparkSession.sql("SELECT to_timestamp('2018-08-04.11:18:29 AM', 'yyyy-MM-dd.hh:mm:ss a') as timestamp")
am/pm is missing from the answer
+-------------------+
| timestamp|
+-------------------+
|2018-08-04 11:18:29|
+-------------------+
but if AM/PM is not present, then it gives the correct answer.
using unix_timestamp
sparkSession.sql("select from_unixtime(unix_timestamp('08-04-2018.11:18:29 AM','dd-MM-yyyy.HH:mm:ss a'), 'dd-MM-yyyy.HH:mm:ss a') as timestamp")
gives the correct answer but the datatype becomes string, whereas my requirement is to convert the datatype to timestamp without data loss.
has anyone has suggestions?
Thanks in advance.