title: How to extract time from timestamp in pyspark?
body: <p>I have a requirement to extract time from timestamp(this is a column in dataframe) using pyspark.
  lets say this is the timestamp 2019-01-03T18:21:39 , I want to extract only time &quot;18:21:39&quot; such that it always appears in this manner &quot;01:01:01&quot;</p>
  <pre><code>df = spark.createDataFrame([&quot;2020-06-17T00:44:30&quot;,&quot;2020-06-17T06:06:56&quot;,&quot;2020-06-17T15:04:34&quot;],StringType()).toDF('datetime')
  
  df=df.select(df['datetime'].cast(TimestampType()))
  </code></pre>
  <p>I tried like below but did not get the expected result</p>
  <pre><code>df1=df.withColumn('time',concat(hour(df['datetime']),lit(&quot;:&quot;),minute(df['datetime']),lit(&quot;:&quot;),second(df['datetime'])))
  
  display(df1)
  </code></pre>
  <pre><code>+-------------------+-------+
  |           datetime|   time|
  +-------------------+-------+
  |2020-06-17 00:44:30|0:44:30|
  |2020-06-17 06:06:56| 6:6:56|
  |2020-06-17 15:04:34|15:4:34|
  +-------------------+-------+
  </code></pre>
  <p>my results are like this <code>6:6:56</code> but i want them to be <code>06:06:56</code></p>