title: to_timestamp() in scala returns default timestamp format
body: <p>I have a dataframe with timestamp in the following format &quot;yyyy-MM-dd HH:mm:ss.SSSSSSS&quot; I want to trim the milliseconds and nanoseconds from the given string and convert that into datetime type.</p>
  <p>I tried using the to_timestamp() method to convert from string to timestamp format, I am successful in that but I am getting the milliseconds and Nanoseconds at the end.</p>
  <p>I tried following to remove milliseconds but none of them worked.</p>
  <ol>
  <li>I tried date Trucate method to remove the milliseconds it worked but
  it converts the column to string format.</li>
  <li>I tried with:</li>
  </ol>
  <pre class="lang-scala prettyprint-override"><code>  to_timestamp($&quot;column_name&quot;, &quot;YYYY-mm-dd HH:MM:ss&quot;)
  </code></pre>
  <p>but I am getting the default format as output. This method did not recoganize my
  custom date time format. Default format I got is --&gt;
  &quot;YYYY-mm-ddTHH:MM:ss.sssss+sss&quot;</p>
  <pre class="lang-scala prettyprint-override"><code>.withColumn(&quot;datetype_timestamp&quot;,
            to_timestamp(col(&quot;RunStartTime&quot;),&quot;YYYY-mm-dd HH:MM:ss&quot;)
             )
  
  </code></pre>
  <p>Above is my code sample, can someone suggest what I should do here please? Thank you for your time :)</p>
  <p>Cluster details:
  10.4 LTS (includes Apache Spark 3.2.1, Scala 2.12)</p>