#Function
to_timestamp() converts a column of strings (in a specified format) into a timestamp type column.
Syntax: -
from pyspark.sql.functions import to_timestamp
to_timestamp(col, format=None)
Example: -
df.withColumn('timestamp_column', to_timestamp(df['date_column'], 'yyyy-MM-dd HH:mm:ss'))
col: The column or string to be converted.format(optional): The date-time format (if the string is in a custom format). IfNone, it assumes the default format (yyyy-MM-dd HH:mm:ss).