Hi i'm trying to get weekday from timestamp with am pm. so I have a dataframe
dataframe = spark.createDataFrame(
data = [ ("1","9/8/2019 10:01:28 PM")],
schema=["id","input_timestamp"])
dataframe.show()
dataframe.printSchema()
And if I do this its giving null as output. I have to do it using to_date
dataframe.withColumn("timestamp",to_date("input_timestamp", "MM/dd/yyyy HH:mm:ss am")) \
.show(truncate=False)
+---+--------------------+---------+
|id |input_timestamp |timestamp|
+---+--------------------+---------+
|1 |9/8/2019 10:01:28 PM|null |
+---+--------------------+---------+