vaio
New Contributor II

I am trying to do it in this way, however, the result is null.

df2 = df.select(col('starting_timestamp'), df.starting_timestamp.cast('timestamp').alias('time'))

+-------------------+----+
| starting_timestamp|time|
+-------------------+----+
|2015/01/01 03:00:36|null|
|2015/01/01 03:01:06|null|
|2015/01/01 03:01:12|null|
|2015/01/01 03:01:20|null|
|2015/01/01 03:01:27|null|
+-------------------+----+
only showing top 5 rows