title: spark convert datetime to timestamp
body: <p>I have a column in pyspark dataframe which is in the format <code>2021-10-28T22:19:03.0030059Z</code> (string datatype). How to convert this into a timestamp datatype in pyspark?</p>
  <p>I'm using the code snippet below but this returns nulls, as it's unable to convert it. Can someone please recommend on how to convert this?</p>
  <pre><code>df3.select(to_timestamp(df.DateTime, 'yyyy-MM-ddHH:mm:ss:SSS').alias('dt'),col('DateTime')).show()
  </code></pre>