Showing posts with label remove seconds from datetime spark sql. Show all posts
Showing posts with label remove seconds from datetime spark sql. Show all posts

Friday, November 5, 2021

Remove seconds pyspark sql

 To remove seconds in pyspark sql in notebook:

SELECT 

        date_trunc('day', current_timestamp) as DateTimeWithZeroHoursMinutes  

        date_trunc('minute', current_timestamp) as DateTimeWithZeroSeconds,

        date_trunc('second', current_timestamp) as DateTimeWithZeroMilliseconds,

        date_format(current_timestamp, "yyyy-MM-dd HH:mm") as DateWithNoSeconds