May 13, 2023

Pyspark trunc() Vs date_trunc()

 

trunc() Vs date_trunc()

trunc()
  • trunks to start date of current month/year

  • trunc MM,yy are passed as second argument

  • Returns date only (not timestamp)


date_trunc()
  • more options than trunc()

  • trunc MM,yy are passed as first argument

  • Returns date timestamp instead of date in trunc()

No comments:

Post a Comment