from pyspark.sql.functions import udf
from pyspark.sql.types import IntegerType
day = udf(lambda date_time: date_time.day, IntegerType())
df.withColumn('day', day(df.date_time))
PySpark add a column to a DataFrame from a TimeStampType column