Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pyspark datetime add hours

# PYSPARK DATAFRAME API

from pyspark.sql.functions import unix_timestamp

df.select((unix_timestamp(df.timestamp_col) + 3600).cast('timestamp'))
# 1 hour = 60 seconds x 60 minutes = 3600 seconds
 
PREVIOUS NEXT
Tagged: #pyspark #datetime #add #hours
ADD COMMENT
Topic
Name
2+1 =